Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IRigidBody2D

Hierarchy

  • ILifecycle
    • IRigidBody2D

Implemented by

Index

Properties

Readonly impl

impl: any

isActive

isActive: () => boolean

Type declaration

    • (): boolean
    • Returns boolean

Readonly isAwake

isAwake: boolean

Readonly isSleeping

isSleeping: boolean

Readonly rigidBody

rigidBody: RigidBody2D

setActive

setActive: (v: boolean) => void

Type declaration

    • (v: boolean): void
    • Parameters

      • v: boolean

      Returns void

setAllowSleep

setAllowSleep: (v: boolean) => void

Type declaration

    • (v: boolean): void
    • Parameters

      • v: boolean

      Returns void

setAngularDamping

setAngularDamping: (v: number) => void

Type declaration

    • (v: number): void
    • Parameters

      • v: number

      Returns void

setFixedRotation

setFixedRotation: (v: boolean) => void

Type declaration

    • (v: boolean): void
    • Parameters

      • v: boolean

      Returns void

setGravityScale

setGravityScale: (v: number) => void

Type declaration

    • (v: number): void
    • Parameters

      • v: number

      Returns void

setLinearDamping

setLinearDamping: (v: number) => void

Type declaration

    • (v: number): void
    • Parameters

      • v: number

      Returns void

Methods

Optional Private preload

  • preload(component: any): void
  • __preload is called before every onLoad.
    It is used to initialize the builtin components internally,
    to avoid checking whether onLoad is called before every public method calls.
    This method should be removed if script priority is supported.

    Parameters

    • component: any

    Returns void

applyAngularImpulse

  • applyAngularImpulse(impulse: number, wake: boolean): any

applyForce

  • applyForce(force: Vec2, point: Vec2, wake: boolean): any

applyForceToCenter

  • applyForceToCenter(force: Vec2, wake: boolean): any

applyLinearImpulse

  • applyLinearImpulse(impulse: Vec2, point: Vec2, wake: boolean): any

applyLinearImpulseToCenter

  • applyLinearImpulseToCenter(impulse: Vec2, wake: boolean): any

applyTorque

  • applyTorque(torque: number, wake: boolean): any

getAngularVelocity

  • getAngularVelocity(): number

getInertia

  • getInertia(): number

getLinearVelocity

  • getLinearVelocity<Out>(out: Out): Out

getLinearVelocityFromWorldPoint

  • getLinearVelocityFromWorldPoint<Out>(worldPoint: IVec2Like, out: Out): Out

getLocalPoint

  • getLocalPoint<Out>(worldPoint: IVec2Like, out: Out): Out

getLocalVector

  • getLocalVector<Out>(worldVector: IVec2Like, out: Out): Out

getMass

  • getMass(): number

getWorldPoint

  • getWorldPoint<Out>(localPoint: IVec2Like, out: Out): Out

getWorldVector

  • getWorldVector<Out>(localVector: IVec2Like, out: Out): Out

initialize

Optional lateUpdate

  • lateUpdate(dt: number): void
  • LateUpdate is called every frame, if the Component is enabled.
    This is a lifecycle method. It may not be implemented in the super class.
    You can only call its super class method inside it. It should not be called manually elsewhere.

    Parameters

    • dt: number

      the delta time in seconds it took to complete the last frame

    Returns void

Optional onDestroy

  • onDestroy(): void
  • Called when this component will be destroyed.
    This is a lifecycle method. It may not be implemented in the super class.
    You can only call its super class method inside it. It should not be called manually elsewhere.

    Returns void

Optional onDisable

  • onDisable(): void
  • Called when this component becomes disabled or its node becomes inactive.
    This is a lifecycle method. It may not be implemented in the super class. You can only call its super class method inside it. It should not be called manually elsewhere.

    Returns void

Optional onEnable

  • onEnable(): void
  • Called when this component becomes enabled and its node is active.
    This is a lifecycle method. It may not be implemented in the super class. You can only call its super class method inside it. It should not be called manually elsewhere.

    Returns void

Optional onFocusInEditor

  • onFocusInEditor(): void

Optional onLoad

  • onLoad(): void
  • When attaching to an active node or its node first activated.
    onLoad is always called before any start functions, this allows you to order initialization of scripts.
    This is a lifecycle method. It may not be implemented in the super class.
    You can only call its super class method inside it. It should not be called manually elsewhere.

    Returns void

Optional onLostFocusInEditor

  • onLostFocusInEditor(): void

Optional onRestore

  • onRestore(): void
  • onRestore is called after the user clicks the Reset item in the Inspector's context menu or performs an undo operation on this component.

    If the component contains the "internal state", short for "temporary member variables which not included
    in its CCClass properties", then you may need to implement this function.

    The editor will call the getset accessors of your component to record/restore the component's state
    for undo/redo operation. However, in extreme cases, it may not works well. Then you should implement
    this function to manually synchronize your component's "internal states" with its public properties.
    Once you implement this function, all the getset accessors of your component will not be called when
    the user performs an undo/redo operation. Which means that only the properties with default value
    will be recorded or restored by editor.

    Similarly, the editor may failed to reset your component correctly in extreme cases. Then if you need
    to support the reset menu, you should manually synchronize your component's "internal states" with its
    properties in this function. Once you implement this function, all the getset accessors of your component
    will not be called during reset operation. Which means that only the properties with default value
    will be reset by editor.

    This function is only called in editor mode.

    Returns void

Optional resetInEditor

  • resetInEditor(): void
  • Called to initialize the component or node’s properties when adding the component the first time or when the Reset command is used. This function is only called in editor.

    Returns void

setAngularVelocity

  • setAngularVelocity(value: number): void

setLinearVelocity

setType

sleep

  • sleep(): void

Optional start

  • start(): void
  • Called before all scripts' update if the Component is enabled the first time.
    Usually used to initialize some logic which need to be called after all components' onload methods called.
    This is a lifecycle method. It may not be implemented in the super class.
    You can only call its super class method inside it. It should not be called manually elsewhere.

    Returns void

Optional update

  • update(dt: number): void
  • Update is called every frame, if the Component is enabled.
    This is a lifecycle method. It may not be implemented in the super class.
    You can only call its super class method inside it. It should not be called manually elsewhere.

    Parameters

    • dt: number

      the delta time in seconds it took to complete the last frame

    Returns void

wakeUp

  • wakeUp(): void

Generated using TypeDoc