Skip to content

Class: Rigidbody

Rigidbody Component Rigid bodies can endow game objects with physical properties, allowing them to be controlled by the physics system and subjected to forces and torques, thus achieving realistic motion effects.

Hierarchy

  • ComponentBase

    Rigidbody

Constructors

Properties

Accessors

Methods

Constructors

constructor

new Rigidbody()

Inherited from

ComponentBase.constructor

Properties

object3D

object3D: Object3D = null

owner object3D

Inherited from

ComponentBase.object3D

Defined in

src/components/ComponentBase.ts:17


isDestroyed

Optional isDestroyed: boolean

Inherited from

ComponentBase.isDestroyed

Defined in

src/components/ComponentBase.ts:38

Accessors

friction

get friction(): number

Get friction value

Returns

number

Defined in

packages/physics/Rigidbody.ts:66

set friction(value): void

Set friction value

Parameters

NameType
valuenumber

Returns

void

Defined in

packages/physics/Rigidbody.ts:72


rollingFriction

get rollingFriction(): number

Get rolling friction value

Returns

number

Defined in

packages/physics/Rigidbody.ts:79

set rollingFriction(value): void

Set rolling friction value

Parameters

NameType
valuenumber

Returns

void

Defined in

packages/physics/Rigidbody.ts:85


restitution

get restitution(): number

Get restitution value

Returns

number

Defined in

packages/physics/Rigidbody.ts:92

set restitution(value): void

Set restitution value

Parameters

NameType
valuenumber

Returns

void

Defined in

packages/physics/Rigidbody.ts:98


btRigidbodyInited

get btRigidbodyInited(): boolean

Check if rigidbody inited

Returns

boolean

Defined in

packages/physics/Rigidbody.ts:105


btRigidbody

get btRigidbody(): btRigidBody

Return internal Ammo.btRigidBody

Returns

btRigidBody

Defined in

packages/physics/Rigidbody.ts:187


mass

get mass(): number

Get mass value。

Returns

number

Defined in

packages/physics/Rigidbody.ts:217

set mass(value): void

Set mass value。

Parameters

NameType
valuenumber

Returns

void

Defined in

packages/physics/Rigidbody.ts:223


velocity

get velocity(): Vector3

Get velocity value of current object

Returns

Vector3

Defined in

packages/physics/Rigidbody.ts:241

set velocity(value): void

Set velocity value of current object

Parameters

NameType
valueVector3

Returns

void

Defined in

packages/physics/Rigidbody.ts:247


angularVelocity

get angularVelocity(): Vector3

Get the angular velocity value of current object

Returns

Vector3

Defined in

packages/physics/Rigidbody.ts:256

set angularVelocity(value): void

Set the angular velocity value of current object

Parameters

NameType
valueVector3

Returns

void

Defined in

packages/physics/Rigidbody.ts:263


isKinematic

get isKinematic(): boolean

Check if the rigidbody affect physics system

Returns

boolean

Defined in

packages/physics/Rigidbody.ts:269

set isKinematic(value): void

Set if the rigidbody affect physics system

Parameters

NameType
valueboolean

Returns

void

Defined in

packages/physics/Rigidbody.ts:275


isTrigger

get isTrigger(): boolean

Returns

boolean

Defined in

packages/physics/Rigidbody.ts:279

set isTrigger(value): void

Parameters

NameType
valueboolean

Returns

void

Defined in

packages/physics/Rigidbody.ts:283


eventDispatcher

get eventDispatcher(): CEventDispatcher

Returns

CEventDispatcher

Inherited from

ComponentBase.eventDispatcher

Defined in

src/components/ComponentBase.ts:23

set eventDispatcher(value): void

Parameters

NameType
valueCEventDispatcher

Returns

void

Inherited from

ComponentBase.eventDispatcher

Defined in

src/components/ComponentBase.ts:28


isStart

get isStart(): boolean

Returns

boolean

Inherited from

ComponentBase.isStart

Defined in

src/components/ComponentBase.ts:40


transform

get transform(): Transform

Return the Transform component attached to the Object3D.

Returns

Transform

Inherited from

ComponentBase.transform

Defined in

src/components/ComponentBase.ts:47


enable

get enable(): boolean

Enable/disable components. The enabled components can be updated, while the disabled components cannot be updated.

Returns

boolean

Inherited from

ComponentBase.enable

Defined in

src/components/ComponentBase.ts:68

set enable(value): void

Enable/disable components. The enabled components can be updated, while the disabled components cannot be updated.

Parameters

NameType
valueboolean

Returns

void

Inherited from

ComponentBase.enable

Defined in

src/components/ComponentBase.ts:54

Methods

init

init(): void

Returns

void

Overrides

ComponentBase.init

Defined in

packages/physics/Rigidbody.ts:51


start

start(): void

Returns

void

Overrides

ComponentBase.start

Defined in

packages/physics/Rigidbody.ts:55


addInitedFunction

addInitedFunction(fun, thisObj): void

Add init callback

Parameters

NameTypeDescription
funFunctioncallback function
thisObjObjectthis

Returns

void

Defined in

packages/physics/Rigidbody.ts:148


removeInitedFunction

removeInitedFunction(fun, thisObj): void

Remove init callback

Parameters

NameTypeDescription
funFunctioncallback function
thisObjObjectthis

Returns

void

Defined in

packages/physics/Rigidbody.ts:156


onUpdate

onUpdate(): void

Returns

void

Overrides

ComponentBase.onUpdate

Defined in

packages/physics/Rigidbody.ts:191


destroy

destroy(force?): void

Parameters

NameType
force?boolean

Returns

void

Overrides

ComponentBase.destroy

Defined in

packages/physics/Rigidbody.ts:208


stop

stop(): void

Returns

void

Inherited from

ComponentBase.stop

Defined in

src/components/ComponentBase.ts:114


onEnable

Optional onEnable(view?): any

Parameters

NameType
view?View3D

Returns

any

Inherited from

ComponentBase.onEnable

Defined in

src/components/ComponentBase.ts:115


onDisable

Optional onDisable(view?): any

Parameters

NameType
view?View3D

Returns

any

Inherited from

ComponentBase.onDisable

Defined in

src/components/ComponentBase.ts:116


onLateUpdate

Optional onLateUpdate(view?): any

Parameters

NameType
view?View3D

Returns

any

Inherited from

ComponentBase.onLateUpdate

Defined in

src/components/ComponentBase.ts:118


onBeforeUpdate

Optional onBeforeUpdate(view?): any

Parameters

NameType
view?View3D

Returns

any

Inherited from

ComponentBase.onBeforeUpdate

Defined in

src/components/ComponentBase.ts:119


onCompute

Optional onCompute(view?, command?): any

Parameters

NameType
view?View3D
command?GPUCommandEncoder

Returns

any

Inherited from

ComponentBase.onCompute

Defined in

src/components/ComponentBase.ts:120


onGraphic

Optional onGraphic(view?): any

Parameters

NameType
view?View3D

Returns

any

Inherited from

ComponentBase.onGraphic

Defined in

src/components/ComponentBase.ts:121


onParentChange

Optional onParentChange(lastParent?, currentParent?): any

Parameters

NameType
lastParent?Object3D
currentParent?Object3D

Returns

any

Inherited from

ComponentBase.onParentChange

Defined in

src/components/ComponentBase.ts:122


cloneTo

cloneTo(obj): void

clone component data to target object3D

Parameters

NameTypeDescription
objObject3Dtarget object3D

Returns

void

Inherited from

ComponentBase.cloneTo

Defined in

src/components/ComponentBase.ts:129


copyComponent

copyComponent(from): Rigidbody

Parameters

NameType
fromRigidbody

Returns

Rigidbody

Inherited from

ComponentBase.copyComponent

Defined in

src/components/ComponentBase.ts:131


beforeDestroy

beforeDestroy(force?): void

before release this component, object refrences are not be set null now.

Parameters

NameType
force?boolean

Returns

void

Inherited from

ComponentBase.beforeDestroy

Defined in

src/components/ComponentBase.ts:198

Released under the MIT License