Version: 2021.3
LanguageEnglish
  • C#

UnityEngine.Physics2DModule

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

The Physics2d module implements 2D physics in Unity.

Classes

AnchoredJoint2DParent class for all joints that have anchor points.
AreaEffector2DApplies forces within an area.
BoxCollider2DCollider for 2D physics representing an axis-aligned rectangle.
BuoyancyEffector2DApplies forces to simulate buoyancy, fluid-flow and fluid drag.
CapsuleCollider2DA capsule-shaped primitive collider.
CircleCollider2DCollider for 2D physics representing an circle.
Collider2DParent class for collider types used with 2D gameplay.
Collision2DCollision details returned by 2D physics callback functions.
CompositeCollider2DA Collider that can merge other Colliders together.
ConstantForce2DApplies both linear and angular (torque) forces continuously to the rigidbody each physics update.
CustomCollider2DRepresents a Collider2D that is configured by assigning PhysicsShape2D geometry to it via a PhysicsShapeGroup2D.
DistanceJoint2DJoint that keeps two Rigidbody2D objects a fixed distance apart.
EdgeCollider2DCollider for 2D physics representing an arbitrary set of connected edges (lines) defined by its vertices.
Effector2DA base class for all 2D effectors.
FixedJoint2DConnects two Rigidbody2D together at their anchor points using a configurable spring.
FrictionJoint2DApplies both force and torque to reduce both the linear and angular velocities to zero.
HingeJoint2DJoint that allows a Rigidbody2D object to rotate around a point in space or a point on another object.
Joint2DParent class for joints to connect Rigidbody2D objects.
Physics2DGlobal settings and helpers for 2D physics.
PhysicsMaterial2DAsset type that defines the surface properties of a Collider2D.
PhysicsSceneExtensions2DScene extensions to access the underlying physics scene.
PhysicsShapeGroup2DRepresents a group of PhysicsShape2D and their geometry.
PhysicsUpdateBehaviour2DA base type for 2D physics components that required a callback during FixedUpdate.
PlatformEffector2DApplies "platform" behaviour such as one-way collisions etc.
PointEffector2DApplies forces to attract/repulse against a point.
PolygonCollider2DCollider for 2D physics representing an arbitrary polygon defined by its vertices.
RelativeJoint2DKeeps two Rigidbody2D at their relative orientations.
Rigidbody2DRigidbody physics component for 2D sprites.
SliderJoint2DJoint that restricts the motion of a Rigidbody2D object to a single line.
SpringJoint2DJoint that attempts to keep two Rigidbody2D objects a set distance apart by applying a force between them.
SurfaceEffector2DApplies tangent forces along the surfaces of colliders.
TargetJoint2DThe joint attempts to move a Rigidbody2D to a specific target position.
WheelJoint2DThe wheel joint allows the simulation of wheels by providing a constraining suspension motion with an optional motor.

Structs

ColliderDistance2DRepresents the separation or overlap of two Collider2D.
ContactFilter2DA set of parameters for filtering contact results. Define the angle by referring to their position in world space, where 0 degrees is parallel to the positive x-axis, 90 degrees is parallel to the positive y-axis, 180 degrees is parallel to the negative x-axis, and 270 degrees is parallel to the negative y-axis.
ContactPoint2DDetails about a specific point of contact involved in a 2D physics collision.
JointAngleLimits2DAngular limits on the rotation of a Rigidbody2D object around a HingeJoint2D.
JointMotor2DParameters for the optional motor force applied to a Joint2D.
JointSuspension2DJoint suspension is used to define how suspension works on a WheelJoint2D.
JointTranslationLimits2DMotion limits of a Rigidbody2D object along a SliderJoint2D.
PhysicsJobOptions2DA set of options that control how physics operates when using the job system to multithread the physics simulation.
PhysicsScene2DRepresents a single instance of a 2D physics Scene.
PhysicsShape2DRepresents an efficient low-level physics shape used by the physics engine.
RaycastHit2DReturns information about an object detected by a raycast in 2D physics.

Enumerations

CapsuleDirection2DThe direction that the capsule sides can extend.
ColliderErrorState2DIndicates what (if any) error was encountered when creating a 2D Collider.
CollisionDetectionMode2DControls how collisions are detected when a Rigidbody2D moves.
EffectorForceMode2DThe mode used to apply Effector2D forces.
EffectorSelection2DSelects the source and/or target to be used by an Effector2D.
ForceMode2DOption for how to apply a force using Rigidbody2D.AddForce.
JointLimitState2DRepresents the state of a joint limit.
PhysicsShapeType2DOptions for indicate which primitive shape type is used to interpret geometry contained within a PhysicsShape2D object.
RigidbodyConstraints2DUse these flags to constrain motion of the Rigidbody2D.
RigidbodyInterpolation2DInterpolation mode for Rigidbody2D objects.
RigidbodySleepMode2DSettings for a Rigidbody2D's initial sleep state.
RigidbodyType2DThe physical behaviour type of the Rigidbody2D.
SimulationMode2DA selection of modes that control when Unity executes the 2D physics simulation.