Acts as the physical representation of the Node it's attached to. It's the connection between the FUDGE rendered world and the Physics world. For the physics to correctly get the transformations rotations need to be applied with from left = true. Or rotations need to happen before scaling.

Author

Marko Fehrenbach, HFU, 2020 | Jirka Dell'Oro-Friedl, HFU, 2021

Hierarchy (view full)

Constructors

  • Creating a new rigidbody with a weight in kg, a physics type (default = dynamic), a collider type what physical form has the collider, to what group does it belong, is there a transform Matrix that should be used, and is the collider defined as a group of points that represent a convex mesh.

    Parameters

    Returns ComponentRigidbody

Properties

collisionMask: number

The groups this object collides with. Groups must be writen in form of e.g. collisionMask = COLLISION_GROUP.DEFAULT | COLLISION_GROUP.... and so on to collide with multiple groups.

collisions: ComponentRigidbody[] = ...

Collisions with rigidbodies happening to this body, can be used to build a custom onCollisionStay functionality.

convexMesh: Float32Array = null

Vertices that build a convex mesh (form that is in itself closed). Needs to set in the construction of the rb if none of the standard colliders is used. Untested and not yet fully supported by serialization and mutation.

initialization: BODY_INIT = BODY_INIT.TO_PIVOT

Automatic adjustment of the pivot when Render.prepare is called according to BODY_INIT

isInitialized: boolean = false

Marks if collider was initialized. Reset to false to initialize again e.g. after manipulation of mtxPivot

mtxPivot: Matrix4x4 = ...

Transformation of the collider relative to the node's transform. Once set mostly remains constant. If altered, isInitialized must be reset to false to recreate the collider in the next Render.prepare

triggerings: ComponentRigidbody[] = ...

Triggers that are currently triggering this body

baseClass: typeof Component = Component

refers back to this class from any subclass e.g. in order to find compatible other resources

iSubclass: number = ...

subclasses get a iSubclass number for identification

subclasses: typeof Component[] = []

list of all the subclasses derived from this class, if they registered properly

Accessors

  • get isSingleton(): boolean
  • Is true, when only one instance of the component class can be attached to a node

    Returns boolean

  • get type(): string
  • Retrieves the type of this mutable subclass as the name of the runtime class

    Returns string

    The type of the mutable

Methods

  • De- / Activate the rigidbodies auto-sleeping function. If activated the rigidbody will automatically sleep when needed, increasing performance. If deactivated the rigidbody gets stopped from sleeping when movement is too minimal. Decreasing performance, for rarely more precise physics results

    Parameters

    • _on: boolean

    Returns void

  • Applies a instant ROTATIONAL-FORCE to the RIGIDBODY in the three dimensions. Considering the rigidbody's MASS Only influencing it's rotation.

    Parameters

    Returns void

  • Applies a continous FORCE at the center of the RIGIDBODY in the three dimensions. Considering the rigidbody's MASS. The force is measured in newton, 1kg needs about 10 Newton to fight against gravity.

    Parameters

    Returns void

  • Applies a instant FORCE at a point/rigidbodycenter to the RIGIDBODY in the three dimensions. Considering the rigidbod's MASS Influencing the angular speed and the linear speed.

    Parameters

    Returns void

  • Applies a instant FORCE to the RIGIDBODY in the three dimensions. Considering the rigidbody's MASS Only influencing it's speed not rotation.

    Parameters

    Returns void

  • Collect applicable attributes of the instance and copies of their values in a Mutator-object. By default, a mutator cannot be extended, since extensions are not available in the object the mutator belongs to. A mutator may be reduced by the descendants of Mutable to contain only the properties needed.

    Returns Mutator

  • Returns the rigidbody in the form the physics engine is using it, should not be used unless a functionality is not provided through the FUDGE Integration.

    Returns RigidBody

  • Sends a ray through this specific body ignoring the rest of the world and checks if this body was hit by the ray, returning info about the hit. Provides the same functionality and information a regular raycast does but the ray is only testing against this specific body.

    Parameters

    • _origin: Vector3
    • _direction: Vector3
    • _length: number
    • _debugDraw: boolean = false

    Returns RayHitInfo

  • Rotating the rigidbody therefore changing it's rotation over time directly in physics. This way physics is changing instead of transform. But you are able to incremental changing it instead of a direct rotation. Although it's always prefered to use forces in physics.

    Parameters

    Returns void

  • Translating the rigidbody therefore changing it's place over time directly in physics. This way physics is changing instead of transform. But you are able to incrementally changing it instead of a direct position. Although it's always prefered to use forces in physics.

    Parameters

    Returns void