Small World Engine API Reference - v0.76.20
    Preparing search index...

    Class RigidBody

    A component that adds Newtonian physics capabilities to an Object3D.

    Index
    • Parameters

      • mass: number = 1.0

        The initial mass. Use 0 for static objects.

      • inertia: number = mass

        The scalar moment of inertia. Defaults to mass.

      Returns RigidBody

    acceleration: Vector3D = ...

    Current acceleration vector.

    angularAcceleration: Vector3D = ...

    Current angular acceleration vector.

    angularDamping: number = 0.98

    Angular damping, simulates rotational friction.

    angularVelocity: Vector3D = ...

    Current angular velocity vector.

    forces: Vector3D = ...

    Accumulated forces for the current integration step.

    friction: number = 0.98

    How much velocity is retained when sliding along a surface (0.0 = ice, 1.0 = velcro).

    inertia: number

    Scalar approximation of moment of inertia.

    inverseInertia: number

    Precalculated inverse inertia.

    inverseMass: number

    Precalculated inverse mass for performance.

    isSensor: boolean = false

    If true, the body detects collisions but does not physically resolve them.

    mass: number

    The mass of the object. 0 means static/kinematic (infinite mass).

    prevPosition: Vector3D = ...

    Position at the start of the most recently completed fixed-timestep substep. Together with the object's current (post-substep) position, this lets PhysicsSystem.applyRenderInterpolation blend the rendered transform between the two, decoupling the render framerate from the fixed physics tick instead of snapping to the latest substep every frame.

    prevRotation: Vector3D = ...

    Rotation (Euler, radians) counterpart to prevPosition -- see its doc for details.

    restitution: number = 0.2

    How much velocity is retained after a bounce (0.0 = clay, 1.0 = superball).

    torque: Vector3D = ...

    Accumulated torque for the current integration step.

    velocity: Vector3D = ...

    Current velocity vector.

    • Applies an instantaneous impulse to the center of mass, directly altering velocity.

      Parameters

      Returns void

    • Clears all accumulated forces and torques. Called by the PhysicsSystem after integration.

      Returns void