Rigidbody
Physics component providing colliders, forces, velocities, tags, and spatial queries.
Module: bezel
Physics component providing colliders, forces, velocities, tags, and spatial queries.
Declaration
export class Rigidbody extends Component { ... }Extends: Component
Properties
sendSignal
The send signal.
sendSignal: string;isSensor
Whether the body detects contacts without producing a physical collision response.
isSensor: boolean;Methods
atAttach
Runs when the component is attached to its parent object.
override atAttach(): void;init
Initializes the component after it is attached.
override init(): void;beforePhysics
Runs immediately before the physics simulation step.
override beforePhysics(): void;update
Updates the component for the current frame.
override update(deltaTime: number): void;clone
Creates a copy of this object.
clone(): Rigidbody;addCollider
Adds collider.
addCollider(collider: Collider): void;setFriction
Sets friction.
setFriction(friction: number): void;applyForce
Applies a force to the body.
applyForce(force: Force3d): void;applyForceAtPoint
Applies a force at the specified position, allowing an off-center force to produce torque.
applyForceAtPoint(force: Force3d, point: Position3d): void;applyImpulse
Applies an instantaneous impulse to the body.
applyImpulse(impulse: Impulse3d): void;setLinearVelocity
Sets linear velocity.
setLinearVelocity(velocity: Velocity3d): void;addLinearVelocity
Adds to the body's current linear velocity.
addLinearVelocity(velocity: Velocity3d): void;setAngularVelocity
Sets angular velocity.
setAngularVelocity(velocity: Velocity3d): void;addAngularVelocity
Adds to the body's current angular velocity.
addAngularVelocity(velocity: Velocity3d): void;setMaxLinearVelocity
Sets maximum linear velocity.
setMaxLinearVelocity(velocity: number): void;setMaxAngularVelocity
Sets maximum angular velocity.
setMaxAngularVelocity(velocity: number): void;getLinearVelocity
Returns linear velocity.
getLinearVelocity(): Velocity3d;getAngularVelocity
Returns angular velocity.
getAngularVelocity(): Velocity3d;getVelocity
Returns velocity.
getVelocity(): Velocity3d;raycast
Raycast.
raycast(direction: Normal3d, maxDistance: number): RaycastResult;raycastAll
Raycast all.
raycastAll(direction: Normal3d, maxDistance: number): RaycastResult;raycastWorld
Raycast world.
raycastWorld(
origin: Position3d,
direction: Normal3d,
maxDistance: number,
): RaycastResult;raycastWorldAll
Raycast world all.
raycastWorldAll(
origin: Position3d,
direction: Normal3d,
maxDistance: number,
): RaycastResult;raycastTagged
Raycast tagged.
raycastTagged(
tags: string[],
direction: Normal3d,
maxDistance: number,
): RaycastResult;raycastTaggedAll
Raycast tagged all.
raycastTaggedAll(
tags: string[],
direction: Normal3d,
maxDistance: number,
): RaycastResult;overlap
Overlap.
overlap(): OverlapResult;overlapWithCollider
Overlap with collider.
overlapWithCollider(collider: Collider): OverlapResult;overlapWithColliderWorld
Overlap with collider world.
overlapWithColliderWorld(
collider: Collider,
position: Position3d,
): OverlapResult;predictMovementWithCollider
Predict movement with collider.
predictMovementWithCollider(
endPosition: Position3d,
collider: Collider,
): SweepResult;predictMovement
Predict movement.
predictMovement(endPosition: Position3d): SweepResult;predictMovementWithColliderWorld
Predict movement with collider world.
predictMovementWithColliderWorld(
startPosition: Position3d,
endPosition: Position3d,
collider: Collider,
): SweepResult;predictMovementWorld
Predict movement world.
predictMovementWorld(
startPosition: Position3d,
endPosition: Position3d,
): SweepResult;predictMovementWithColliderAll
Predict movement with collider all.
predictMovementWithColliderAll(
endPosition: Position3d,
collider: Collider,
): SweepResult;predictMovementAll
Predict movement all.
predictMovementAll(endPosition: Position3d): SweepResult;predictMovementWithColliderAllWorld
Predict movement with collider all world.
predictMovementWithColliderAllWorld(
startPosition: Position3d,
endPosition: Position3d,
collider: Collider,
): SweepResult;predictMovementAllWorld
Predict movement all world.
predictMovementAllWorld(
startPosition: Position3d,
endPosition: Position3d,
): SweepResult;hasTag
Reports whether this value has tag.
hasTag(tag: string): boolean;addTag
Adds tag.
addTag(tag: string): void;removeTag
Removes tag.
removeTag(tag: string): void;setDamping
Sets damping.
setDamping(linearDamping: number, angularDamping: number): void;setMass
Sets mass.
setMass(mass: number): void;setRestituition
Sets collision restitution (bounciness); the method name retains its existing spelling.
setRestituition(restitution: number): void;setMotionType
Selects a static, dynamically simulated, or kinematic body.
setMotionType(motionType: "Static" | "Dynamic" | "Kinematic"): void;