Scripting
Scripts move bodies through the Rigid Body 2D component and ask the world what is where through aego/physics.
body := node.Get<Body2D>()
v := body.Velocity
body.SetVelocity(Vec2{x * Speed, v.Y})
body.ApplyImpulse(JumpImpulse)
On this page
Moving a body
- Forces and torque act during the next physics step. Call
ApplyForceandApplyTorquefromFixedUpdate. - Impulses change the velocity at once, scaled by mass. They suit jumps and hits.
MoveTodrives a kinematic body to a pose by the end of the next step.Teleportmoves a body without sweeping and keeps its velocity.
Every method is listed on the Rigid Body 2D page.
Queries
Raycasts, line casts and overlap tests ignore the caller's own body and skip triggers. They work only during Play. Functions that fill an out slice write at most len(out) entries, so size the slice once with append and reuse it.
Every function is listed on the aego/physics page.