BodyComp
Defined in: packages/threeplay/src/plugins/physics/types.ts:99
Fields added by body(). Requires area(). It is a MoveHandler:
move() sets the horizontal velocity of dynamic bodies and translates
kinematic ones (static bodies ignore it, with a warning).
Dynamic bodies are interpolated: from update on, pos/rot hold the
visual pose of the frame, up to one fixed step (20 ms) behind the simulation.
fixedUpdate and collision callbacks see the latest simulated pose, and
raycast, vel and isGrounded() always use the simulation. Assigning pos
or rot from code teleports the body. Opt out with body({ interpolate: false }).
Extends
Section titled “Extends”Methods
Section titled “Methods”add()?
Section titled “add()?”
optionaladd(this):void
Defined in: packages/threeplay/src/core/types.ts:63
Called when the object enters the scene (or when used on a live object).
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”applyForce()
Section titled “applyForce()”applyForce(
force):void
Defined in: packages/threeplay/src/plugins/physics/types.ts:106
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
applyImpulse()
Section titled “applyImpulse()”applyImpulse(
impulse):void
Defined in: packages/threeplay/src/plugins/physics/types.ts:105
Parameters
Section titled “Parameters”impulse
Section titled “impulse”Returns
Section titled “Returns”void
applyMove()
Section titled “applyMove()”applyMove(
delta,velocity):void
Defined in: packages/threeplay/src/plugins/transform/types.ts:36
delta is the displacement for this frame, velocity the requested units/s.
Parameters
Section titled “Parameters”Vector3
velocity
Section titled “velocity”Vector3
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”applyTorqueImpulse()
Section titled “applyTorqueImpulse()”applyTorqueImpulse(
torque):void
Defined in: packages/threeplay/src/plugins/physics/types.ts:107
Parameters
Section titled “Parameters”torque
Section titled “torque”Returns
Section titled “Returns”void
destroy()?
Section titled “destroy()?”
optionaldestroy(this):void
Defined in: packages/threeplay/src/core/types.ts:69
Called when the object is destroyed or the component removed.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”fixedUpdate()?
Section titled “fixedUpdate()?”
optionalfixedUpdate(this):void
Defined in: packages/threeplay/src/core/types.ts:67
Called at the fixed physics rate (50 Hz by default).
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”inspect()?
Section titled “inspect()?”
optionalinspect(this):string|null|undefined
Defined in: packages/threeplay/src/core/types.ts:71
Short status line shown by the debug inspector.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”string | null | undefined
Inherited from
Section titled “Inherited from”isFalling()
Section titled “isFalling()”isFalling():
boolean
Defined in: packages/threeplay/src/plugins/physics/types.ts:112
Returns
Section titled “Returns”boolean
isGrounded()
Section titled “isGrounded()”isGrounded():
boolean
Defined in: packages/threeplay/src/plugins/physics/types.ts:111
true if standing on something (ground probe below the collider).
Returns
Section titled “Returns”boolean
jump()
Section titled “jump()”jump(
force?):void
Defined in: packages/threeplay/src/plugins/physics/types.ts:109
Sets the vertical velocity (default 8).
Parameters
Section titled “Parameters”force?
Section titled “force?”number
Returns
Section titled “Returns”void
onGround()
Section titled “onGround()”onGround(
fn):EventController
Defined in: packages/threeplay/src/plugins/physics/types.ts:114
When the body lands.
Parameters
Section titled “Parameters”() => void
Returns
Section titled “Returns”teleport()
Section titled “teleport()”teleport(
to):void
Defined in: packages/threeplay/src/plugins/physics/types.ts:116
Teleports, resetting velocity.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
update()?
Section titled “update()?”
optionalupdate(this):void
Defined in: packages/threeplay/src/core/types.ts:65
Called once per frame.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Properties
Section titled “Properties”angularVel
Section titled “angularVel”angularVel:
Vector3
Defined in: packages/threeplay/src/plugins/physics/types.ts:104
Angular velocity in degrees/s.
conflicts?
Section titled “conflicts?”
optionalconflicts?:string[]
Defined in: packages/threeplay/src/core/types.ts:61
Ids of components that can’t be on the same object (checked both ways).
Inherited from
Section titled “Inherited from”id:
"body"
Defined in: packages/threeplay/src/plugins/physics/types.ts:100
Unique name. Two components with the same id replace each other.
Overrides
Section titled “Overrides”require?
Section titled “require?”
optionalrequire?:string[]
Defined in: packages/threeplay/src/core/types.ts:59
Ids of components that must be present on the object.
Inherited from
Section titled “Inherited from”vel:
Vector3
Defined in: packages/threeplay/src/plugins/physics/types.ts:102
Linear velocity in units/s (read or assign).