Hierarchy (view full)

Implements

  • IRigidbody

Properties

angularDrag: number = 1
autoMass: boolean = true

When true the mass will be automatically calculated by the attached colliders

collisionDetectionMode: CollisionDetectionMode = CollisionDetectionMode.Discrete
dominanceGroup: number = 0

Rigidbodies with higher dominance will be immune to forces originating from contacts with rigidbodies of lower dominance.

drag: number = 0
sleepThreshold: number = 0.01

Accessors

  • get activeAndEnabled(): boolean
  • Returns boolean

  • get context(): Context
  • Returns Context

  • set context(context): void
  • Parameters

    Returns void

  • get destroyed(): boolean
  • Returns boolean

  • get enabled(): boolean
  • Returns boolean

  • set enabled(val): void
  • Parameters

    • val: boolean

    Returns void

  • get forward(): Vector3
  • Forward (0,0,-1) vector in world space

    Returns Vector3

  • get gravityScale(): number
  • Returns number

  • set gravityScale(val): void
  • Gravity is such a common force that it is implemented as a special case (even if it could easily be implemented by the user using force application). Note however that a change of gravity won't automatically wake-up the sleeping bodies so keep in mind that you may want to wake them up manually before a gravity change.

    It is possible to change the way gravity affects a specific rigid-body by setting the rigid-body's gravity scale to a value other than 1.0. The magnitude of the gravity applied to this body will be multiplied by this scaling factor. Therefore, a gravity scale set to 0.0 will disable gravity for the rigid-body whereas a gravity scale set to 2.0 will make it twice as strong. A negative value will flip the direction of the gravity for this rigid-body.

    Parameters

    • val: number

    Returns void

  • get hideFlags(): HideFlags
  • Returns HideFlags

  • get isComponent(): boolean
  • Returns boolean

  • get layer(): number
  • Returns number

  • get mass(): number
  • Returns number

  • set mass(value): void
  • By default the mass will be automatically calculated (see autoMass) by the physics engine using the collider sizes
    To set the mass manually you can either set the mass value or set autoMass to false

    Parameters

    • value: number

    Returns void

  • get name(): string
  • Returns string

  • set name(str): void
  • Parameters

    • str: string

    Returns void

  • get right(): Vector3
  • Right (1,0,0) vector in world space

    Returns Vector3

  • get scene(): Scene
  • Returns Scene

  • get smoothedVelocity(): Vector3
  • Returns the rigidbody velocity smoothed over ~ 10 frames

    Returns Vector3

  • get static(): any
  • Returns any

  • get tag(): string
  • Returns string

  • set tag(str): void
  • Parameters

    • str: string

    Returns void

  • get up(): Vector3
  • Up (0,1,0) vector in world space

    Returns Vector3

  • get worldEuler(): Euler
  • Returns Euler

  • set worldEuler(val): void
  • Parameters

    • val: Euler

    Returns void

  • get worldPosition(): Vector3
  • Returns Vector3

  • set worldPosition(val): void
  • Parameters

    • val: Vector3

    Returns void

  • get worldQuaternion(): Quaternion
  • Returns Quaternion

  • set worldQuaternion(val): void
  • Parameters

    • val: Quaternion

    Returns void

  • get worldRotation(): Vector3
  • Returns Vector3

  • set worldRotation(val): void
  • Parameters

    • val: Vector3

    Returns void

Methods

  • Type Parameters

    Parameters

    • type: string
    • listener: ((evt) => any)
        • (evt): any
        • Parameters

          • evt: T

          Returns any

    Returns void

  • called once when the component becomes active for the first time

    Returns void

  • Returns void

  • Returns void

  • Returns void

  • Returns void

  • Parameters

    • frame: any

    Returns void

  • Returns void

  • Returns void

  • called every time when the component gets enabled (this is invoked after awake and before start)

    Returns void

  • Called for all scripts when the context gets paused or unpaused

    Parameters

    • isPaused: boolean
    • wasPaused: boolean

    Returns void

  • Parameters

    • col: ICollider

    Returns any

  • Parameters

    • col: ICollider

    Returns any

  • Parameters

    • col: ICollider

    Returns any

  • called when you decorate fields with the @validate() decorator

    Returns void

  • Type Parameters

    Parameters

    • type: string
    • listener: ((arg) => any)
        • (arg): any
        • Parameters

          • arg: T

          Returns any

    Returns void

  • Parameters

    • wakeup: boolean = true

    Returns void

  • Returns void

  • Parameters

    • wakeup: boolean = true

    Returns void

  • Returns void

  • called on a component with a map of old to new guids (e.g. when instantiate generated new guids and e.g. timeline track bindings needs to remape them)

    Parameters

    • guidsMap: GuidsMap

    Returns void

  • Parameters

    • x: any
    • Optional y: number
    • Optional z: number
    • wakeup: boolean = true

    Returns void

  • d

    Parameters

    • _velocity: any = null

    Returns void

    Deprecated

    not used anymore and will be removed in a future update

  • Set the angular velocity of a rigidbody (equivalent to calling setAngularVelocity)

    Parameters

    • x: any
    • y: number
    • z: number

    Returns void

  • Parameters

    • x: any
    • Optional y: number
    • Optional z: number
    • wakeup: boolean = true

    Returns void

  • Parameters

    • x: number
    • y: number
    • z: number
    • w: number

    Returns void

  • Parameters

    • x: number
    • y: number
    • z: number
    • degrees: boolean = true

    Returns void

  • Returns void

  • Parameters

    • routine: Generator<unknown, any, unknown>
    • evt: FrameEvent = FrameEvent.Update

    Returns void

  • Will reset forces before setting the object world position

    Parameters

    • pt: {
          x: number;
          y: number;
          z: number;
      }
      • x: number
      • y: number
      • z: number
    • localspace: boolean = true

    Returns void

  • Returns void

  • When a dynamic rigid-body doesn't move (or moves very slowly) during a few seconds, it will be marked as sleeping by the physics pipeline. Rigid-bodies marked as sleeping are no longer simulated by the physics engine until they are woken up. That way the physics engine doesn't waste any computational resources simulating objects that don't actually move. They are woken up automatically whenever another non-sleeping rigid-body starts interacting with them (either with a joint, or with one of its attached colliders generating contacts).

    Returns void

Generated using TypeDoc