Recursive AI

Coming from Unity

All onephysics docs

OnePhysics uses Unity's vocabulary for the happy path where it can, with these differences: there are no GameObjects, so the Body is the thing you hold; the world is an object you create and step (there is no global Physics2D); angles are radians; box sizes are full sizes; and positions are double. The 3D names are the same as the 2D names listed here, on PhysicsWorld3D and its Body.

UnityOnePhysicsNote
Physics2D.Simulate(dt), FixedUpdateworld.Step(dt)Fixed dt; the world has no clock.
Time.fixedDeltaTimethe dt you passYou choose it, the same on every peer.
Physics2D.gravityworld.Options.GravityTakes effect at the next step.
Rigidbody2DBodyA struct handle; allocates nothing.
rb.bodyType (Dynamic, Kinematic, Static)body.Type, BodyType.Dynamic/Kinematic/StaticFixed at creation (type: argument or BodyDef.Type).
rb.isKinematicbody.IsKinematic
rb.velocitybody.LinearVelocity
rb.angularVelocity (degrees/s)body.AngularVelocityRadians/s.
rb.position, rb.rotation (degrees)body.Position, body.Angle (radians), body.RotationSetTransform(position, angleRadians) teleports.
rb.massbody.MassFrom shape density.
rb.AddForce(f)body.ApplyForce(f)Cleared each step.
rb.AddForce(f, ForceMode2D.Impulse)body.ApplyImpulse(i)
rb.AddForceAtPosition(f, p)body.ApplyForceAt(f, p), ApplyImpulseAt
rb.AddTorque(t)body.ApplyTorque(t)
rb.IsSleeping(), Sleep(), WakeUp()!body.IsAwake, body.Sleep(), body.Wake()
rb.gravityScale, drag, angularDragBodyDef.GravityScale, LinearDamping, AngularDamping
freeze rotation constraintBodyDef.FixedRotation
CollisionDetectionMode2D.ContinuousBodyDef.IsBulletStatic geometry is always swept; bullets also sweep against other moving bodies.
Destroy(gameObject)body.Destroy()A destroyed handle throws StaleHandleException.
BoxCollider2D, CircleCollider2D, CapsuleCollider2D, PolygonCollider2D, EdgeCollider2DAddBox, AddCircle, AddCapsule, AddPolygon, AddSegment/AddChain; or CreateBox etc. on an existing bodyA body can have many shapes.
collider.isTriggerShapeDef.IsSensor
PhysicsMaterial2D (friction, bounciness)Material2D(friction, restitution, rollingResistance), or ShapeDef fields
gameObject.layerbody.Layer (0 to 31)
Physics2D.IgnoreLayerCollision(a, b)world.IgnoreLayerCollision(a, b)
OnCollisionEnter2D, Stay, Exitbody.OnCollisionEnter, OnCollisionStay, OnCollisionExitStay needs EventMask.ContactPersist in the world options.
collision.gameObject, collision.colliderc.Other, c.OtherShape
collision.GetContact(0).pointc.Point, c.GetPoint(i)
collision.relativeVelocityc.ApproachSpeedApproach speed along the normal.
OnTriggerEnter2D, OnTriggerExit2Dbody.OnTriggerEnter, OnTriggerExitTrigger.Other.
Physics2D.Raycast, RaycastAllworld.Raycast, RaycastAllPositions are double; the direction is a float vector.
Physics2D.CircleCast, BoxCast, CapsuleCastworld.CircleCast, BoxCast, CapsuleCast
Physics2D.OverlapCircle, OverlapBox, OverlapPointworld.OverlapCircle, OverlapBox, OverlapPoint (and ...All, ...Any)
Physics2D.OverlapCircleNonAllocworld.OverlapCircleAll(center, radius, span)Fills your span.
Collider2D.ClosestPoint, Physics2D.Distanceworld.ClosestPoint
ContactFilter2D (layer mask, trigger toggle)QueryFilter2D (LayerMask, IncludeSensors, Predicate)
HingeJoint2Dworld.AddHinge(a, b, anchor) returning HingeJointRadians.
SliderJoint2D, FixedJoint2D, WheelJoint2DAddSlider, AddFixed, AddWheel
DistanceJoint2D, SpringJoint2DAddDistance, AddSpring
TargetJoint2D, RelativeJoint2DAddTarget, AddRelative
CharacterController.Move(motion)character.Move(displacement, dt)Displacement for this frame.
CharacterController.SimpleMove(v)character.MoveVelocity(velocity, dt)
isGrounded, slopeLimit (degrees), stepOffsetIsGrounded, SlopeLimitRadians, StepOffsetRadians.
OnControllerColliderHitcharacter.OnControllerColliderHit
Physics.Raycast, Rigidbody, ... (3D)the same names on PhysicsWorld3D and its BodyThe 3D engine is a preview.

The joint one-liner to definition to view table is in names and conventions. If a Unity feature you rely on is missing, the middle tier (the tiers) usually has it under the engine's own name.