interface PhysicsBody extends Component
A Box2D body while the game plays. Its shape is the GameObject's BoxCollider (size only: offset,
scale and rotation are not applied), friction 1, fixed rotation; the transform's position follows
it. Built when Play starts, after every script's Initialize. Live settings store their values even
without a body; forces and velocity methods need a body. Units are Box2D's: newtons, N·s, m/s (100 px = 1 m).
DropThrough(seconds?: number): void;Pass through every one-way Terrain for 0.25 seconds by default; repeating extends the window.
The next physics step releases a standing contact with one onContactExit and clears its grounding.
Two-sided terrain and other bodies are unaffected; a pass raises no further contact hooks.
dropThrough(seconds?: number): void;bodyType: 'static' | 'dynamic' | 'kinematic';Live. 'kinematic' moves only by its velocity; static to dynamic starts at rest and wakes.
friction: number;Live surface friction on every fixture, including existing contacts (default 1).
restitution: number;Live bounciness on every fixture, 0 – 1 (default 0).
linearDamping: number;Live damping: slows the body over time, 1/s (default 0).
gravityScale: number;Live gravity scale: 0 floats, 1 normal, -1 falls up (default 1).
fitShape: boolean;Fit the body to its collider: its offset and the transform's scale (default false: 2018's box).
fixedRotation: boolean;Live. False lets the body rotate; the transform's rotation follows it (default true).
SetBodyType(value: 'static' | 'dynamic' | 'kinematic'): void;SetGravityScale(value: number): void;SetLinearDamping(value: number): void;SetFriction(value: number): void;SetRestitution(value: number): void;SetSensor(value: boolean): void;SetFixedRotation(value: boolean): void;SetAwake(value: boolean): void;Wake or put the body to sleep; does nothing without a body. Sleeping clears its velocity.
IsAwake(): boolean;False without a body.
readonly isGrounded: boolean;Standing on something: touching a solid body whose contact normal points up within 45° of vertical.
False before Play has built the body.
readonly IsGrounded: boolean;GetContacts(): GameObject[];The GameObjects whose bodies touch this one now (sensors included).
getContacts(): GameObject[];SetVelocityPx(x: number, y: number): void;Velocity in pixels per second.
GetVelocityPxX(): number;GetVelocityPxY(): number;density: number;Shapes the body.
isStatic: boolean;Live alias for bodyType: true sets static, false changes static to dynamic.
isSensor: boolean;Live on every fixture: overlaps instead of colliding, while keeping contact reports.
mass: number;Stored and returned by their getters, as in 2018; the body does not read them.
inertia: number;angularVelocity: number;velocityX: number;velocityY: number;IsStatic: boolean;IsSensor: boolean;ApplyForce(x: number, y: number): void;A force in newtons at the centre of mass, for the next step.
ApplyLinearImpulse(x: number, y: number): void;An impulse in N·s: an immediate change of velocity.
SetLinearVelocity(x: number, y: number): void;In m/s.
SetLinearVelocityX(x: number): void;SetLinearVelocityY(y: number): void;GetLinearVelocityX(): number;The body's velocity in m/s; 0 before Play.
GetLinearVelocityY(): number;SetPosition(x: number, y: number): void;Teleports: moves the GameObject to (x, y) in pixels, and its body with it, keeping the body's
velocity and waking it. Writing Transform.Position alone is undone by the next physics step.
setPosition(x: number, y: number): void;Same as SetPosition.
GetVelocityX(): number;The stored values (2018 names).
GetVelocityY(): number;GetAngularVelocity(): number;GetInertia(): number;GetDensity(): number;GetMass(): number;SetVelocityX(value: number): void;SetVelocityY(value: number): void;SetAngularVelocity(value: number): void;SetInertia(value: number): void;SetDensity(value: number): void;SetMass(value: number): void;