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
Methods
- init
- start
- addInitedFunction
- removeInitedFunction
- onUpdate
- destroy
- stop
- onEnable
- onDisable
- onLateUpdate
- onBeforeUpdate
- onCompute
- onGraphic
- cloneTo
Accessors
- friction
- rollingFriction
- restitution
- btRigidbodyInited
- btRigidbody
- mass
- velocity
- angularVelocity
- isKinematic
- isTrigger
- transform
- enable
Properties
Constructors
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
Name | Type | Description |
---|---|---|
fun | Function | callback function |
thisObj | Object | this |
Returns
void
Defined in
packages/physics/Rigidbody.ts:148
removeInitedFunction
▸ removeInitedFunction(fun
, thisObj
): void
Remove init callback
Parameters
Name | Type | Description |
---|---|---|
fun | Function | callback function |
thisObj | Object | this |
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(): void
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:108
onEnable
▸ Optional
onEnable(view?
): any
Parameters
Name | Type |
---|---|
view? | View3D |
Returns
any
Inherited from
ComponentBase.onEnable
Defined in
src/components/ComponentBase.ts:109
onDisable
▸ Optional
onDisable(view?
): any
Parameters
Name | Type |
---|---|
view? | View3D |
Returns
any
Inherited from
ComponentBase.onDisable
Defined in
src/components/ComponentBase.ts:110
onLateUpdate
▸ Optional
onLateUpdate(view?
): any
Parameters
Name | Type |
---|---|
view? | View3D |
Returns
any
Inherited from
ComponentBase.onLateUpdate
Defined in
src/components/ComponentBase.ts:112
onBeforeUpdate
▸ Optional
onBeforeUpdate(view?
): any
Parameters
Name | Type |
---|---|
view? | View3D |
Returns
any
Inherited from
ComponentBase.onBeforeUpdate
Defined in
src/components/ComponentBase.ts:113
onCompute
▸ Optional
onCompute(view?
, command?
): any
Parameters
Name | Type |
---|---|
view? | View3D |
command? | GPUCommandEncoder |
Returns
any
Inherited from
ComponentBase.onCompute
Defined in
src/components/ComponentBase.ts:114
onGraphic
▸ Optional
onGraphic(view?
): any
Parameters
Name | Type |
---|---|
view? | View3D |
Returns
any
Inherited from
ComponentBase.onGraphic
Defined in
src/components/ComponentBase.ts:115
cloneTo
▸ cloneTo(obj
): void
clone component data to target object3D
Parameters
Name | Type | Description |
---|---|---|
obj | Object3D | target object3D |
Returns
void
Inherited from
ComponentBase.cloneTo
Defined in
src/components/ComponentBase.ts:122
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
Name | Type |
---|---|
value | number |
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
Name | Type |
---|---|
value | number |
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
Name | Type |
---|---|
value | number |
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
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
Name | Type |
---|---|
value | number |
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
Name | Type |
---|---|
value | Vector3 |
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
Name | Type |
---|---|
value | Vector3 |
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
Name | Type |
---|---|
value | boolean |
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
Name | Type |
---|---|
value | boolean |
Returns
void
Defined in
packages/physics/Rigidbody.ts:283
transform
• get
transform(): Transform
Return the Transform component attached to the Object3D.
Returns
Transform
Inherited from
ComponentBase.transform
Defined in
src/components/ComponentBase.ts:38
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:59
• set
enable(value
): void
Enable/disable components. The enabled components can be updated, while the disabled components cannot be updated.
Parameters
Name | Type |
---|---|
value | boolean |
Returns
void
Inherited from
ComponentBase.enable
Defined in
src/components/ComponentBase.ts:45
Properties
object3D
• object3D: Object3D
= null
owner object3D
Inherited from
ComponentBase.object3D
Defined in
src/components/ComponentBase.ts:17
Constructors
constructor
• new Rigidbody()
Inherited from
ComponentBase.constructor