Documentation

Unity Engine

Download Unity

Unity Engine

UnityEngine.PhysicsCore2DModule

The PhysicsCore2D module contains all the core 2D physics features.
Read time 6 minutesLast updated 7 hours ago

Definition

  • Type: Module

Classes

Class

Description

PhysicsCoreSettings2DPhysicsCore Settings Asset. This contains all the global physics options along with the default values for the following definitions:
PhysicsHandleExtensionsExtensions that let a physics handle be written through when it is reached by something other than a plain variable.
PhysicsResultExtensionsFluent filtering extensions for the physics result arrays returned by queries, events, and other physics operations.

Structs

Struct

Description

CapsuleGeometryThe geometry of a closed capsule which can be viewed as two semi-circles connected by a rectangle. See PhysicsBody.CreateShape.
ChainGeometryThe geometry of a chain of ChainSegment.
ChainSegmentGeometryThe geometry of a chain line segment with one-sided collision which only collides on the "right" side. Several of these are generated for a chain, connected as ghost1 -> point1 -> point2 -> ghost2.
CircleGeometryThe geometry of a closed circle. See PhysicsBody.CreateShape.
PhysicsAABBRepresents a 2D axis-aligned bounding box.
PhysicsBodyA body is contained within a world and has 3 degrees-of-freedom, two for position and one for rotation. A body can have forces, torques and impulses applied to it. A body has three distinct types:
PhysicsBodyDefinitionA PhysicsBody definition used to specify important initial properties.
PhysicsCallbacksAll callback interfaces and targets.
PhysicsChainA dedicated shape that produces a chain of shapes connected together to produce a continuous surface. Chain shapes provide a smooth, continuous surface that will not produce "ghost" collisions. A PhysicsChain is automatically destroyed when the body it is in is destroyed. A PhysicsChain cannot exist unattached from a body.
PhysicsChainDefinitionA PhysicsChain definition used to specify the chain of vertices that will produce multiple ChainSegmentGeometry shape types. Additionally, non-geometric properties can be specified here.
PhysicsComposerProvides the ability to compose geometry using specific operations on layers in a specific order.
PhysicsConstantsConstants used throughout the 2D physics system.
PhysicsDestructorProvides the ability to destruct (fragment and Slice) geometry.
PhysicsDistanceJointConnects an anchor point on body A with an anchor point on body B via a line segment of a specified distance.
PhysicsDistanceJointDefinitionA joint definition used to specify properties when creating a PhysicsDistanceJoint.
PhysicsEventsVarious events that can be retrieved during and after the simulation has completed. See PhysicsWorld.Simulate and PhysicsWorld.Simulate.
PhysicsFixedJointA joint to constrain a pair of bodies together rigidly. This constraint provides springs to mimic soft-body simulation. The approximate solver cannot always hold many bodies together completely rigidly.
PhysicsFixedJointDefinitionA joint definition used to specify properties when creating a PhysicsFixedJoint.
PhysicsHandleAn abstract handle that can be used for custom purposes such as handling miscellaneous physics object types abstractly. You can create a handle with PhysicsHandle.Create or PhysicsHandle.CreateBatch. You can destroy a handle with PhysicsHandle.Destroy or PhysicsHandle.DestroyBatch.
PhysicsHingeJointA joint where an anchor point on body B is fixed to an anchor point on body A. This joint allows relative rotation.
PhysicsHingeJointDefinitionA joint definition used to specify properties when creating a PhysicsHingeJoint.
PhysicsIgnoreJointA joint used to ignore collision between two specific bodies. As a side effect of being a joint, it also keeps the two bodies in the same simulation island meaning they'll wake/sleep at the same time and be solved together on the same thread.
PhysicsIgnoreJointDefinitionA joint definition used to specify properties when creating a PhysicsIgnoreJoint.
PhysicsJointA joint is used to constrain bodies to the world or to each other in various ways. A joint is automatically destroyed when either body it is attached to is destroyed. A joint cannot exist unattached from a body.
PhysicsLayersThis provides a common method to retrieving layer information. If a PhysicsCoreSettings2D asset is assigned then the full layers (PhysicsCoreSettings2D.physicsLayerNames) will be used if PhysicsCoreSettings2D.usePhysicsLayers is also active. If no PhysicsCoreSettings2D asset is assigned then the global layers (See LayerMask) will be used.
PhysicsMaskA 64-bit mask, effectively 64 flags. The default enumerator will iterate all the bits that are set (1).
PhysicsMathA set of mathematical operations that are useful for physics. These operations do not form a fully comprehensive mathematics library, they simply provide operations that are usually required when interacting with physics.
PhysicsPlaneRepresents a 2D plane.
PhysicsQueryVarious physics queries.
PhysicsRelativeJointA joint constraint used to control the relative movement two bodies while still being responsive to collisions. A spring controls the position and rotation and velocity control allows for simulated friction such as seen in top-down games. A typical usage is to control the movement of a dynamic body with respect to the ground.
PhysicsRelativeJointDefinitionA joint definition used to specify properties when creating a PhysicsRelativeJoint.
PhysicsResultEnumerable<T, TFilter>A lazy, allocation-free view over a physics result array that yields only the elements a filter keeps.
PhysicsRotateRepresents a 2D rotation.
PhysicsShapeA shape is attached to a body and defines an area to which two distinct types of behaviour are handled:
PhysicsShapeDefinitionA PhysicsShape definition used to specify important initial properties.
PhysicsSliderJointA joint that requires defining a line of motion defined by the local anchor A. Body B may slide along the axis defined by the local anchor A. Body B cannot rotate relative to body A. The joint translation is zero when the local anchor origins coincide in world space. The joint uses local anchors so that the initial configuration can violate the constraint slightly.
PhysicsSliderJointDefinitionA joint definition used to specify properties when creating a PhysicsSliderJoint.
PhysicsSpaceProvides the ability to store and query information in a spatial database.
PhysicsTransformRepresents a 2D transformation combining a translation and a PhysicsRotate.
PhysicsUserDataCustom user data. The physics system doesn't use this data, it is entirely for custom use.
PhysicsWheelJointA joint that requires defining a line of motion using an axis and an anchor point. The joint translation is zero when the local anchors coincide in world space. The joint uses local anchors so that the initial configuration can violate the constraint slightly.
PhysicsWheelJointDefinitionA joint definition used to specify properties when creating a PhysicsWheelJoint.
PhysicsWorldA world is a container for all other physics objects such as PhysicsBody, PhysicsShape, PhysicsJoint etc. A world can be simulated in isolation from all other worlds. The number of worlds allocated up-front is defined by PhysicsCoreSettings2D.initialWorldCapacity, after which more are allocated on demand as required. A world is completely isolated from all other worlds.
PhysicsWorldDefinitionA PhysicsWorld definition used to specify important initial properties.
PolygonGeometryThe geometry of a closed convex polygon.
SegmentGeometryThe geometry of a line segment. See PhysicsBody.CreateShape.

Interfaces

Interface

Description

IPhysicsResultFilter<T>A filter applied to each element of a physics result array during enumeration.