Class: RopeSoftbody
Hierarchy
SoftbodyBase↳
RopeSoftbody
Constructors
Properties
- fixeds
- fixNodeIndices
- elasticity
- anchorRigidbodyHead
- anchorRigidbodyTail
- anchorOffsetHead
- anchorOffsetTail
- mass
- margin
- group
- mask
- influence
- disableCollision
- object3D
- isDestroyed
Accessors
Methods
- buildRopeGeometry
- start
- setElasticity
- clearAnchors
- onUpdate
- destroy
- init
- wait
- appendAnchor
- applyFixedNodes
- clearFixedNodes
- stop
- onEnable
- onDisable
- onLateUpdate
- onBeforeUpdate
- onCompute
- onGraphic
- onParentChange
- onAddChild
- onRemoveChild
- cloneTo
- copyComponent
- beforeDestroy
Constructors
constructor
• new RopeSoftbody(): RopeSoftbody
Returns
Inherited from
SoftbodyBase.constructor
Properties
fixeds
• fixeds: number = 0
绳索两端的固定选项,默认值为 0
0:两端不固定,1:起点固定,2:终点固定,3:两端固定
Defined in
packages/physics/softbody/RopeSoftbody.ts:13
fixNodeIndices
• fixNodeIndices: number[] = []
固定节点索引,与 fixeds 属性作用相同,但可以更自由的控制任意节点。
Defined in
packages/physics/softbody/RopeSoftbody.ts:18
elasticity
• elasticity: number = 0.5
绳索弹性,值越大弹性越低,通常设置为 0 到 1 之间,默认值为 0.5。
Defined in
packages/physics/softbody/RopeSoftbody.ts:23
anchorRigidbodyHead
• anchorRigidbodyHead: Rigidbody
绳索起点处锚定的刚体,设置此项后绳索的起点将与该刚体的位置相同。
Defined in
packages/physics/softbody/RopeSoftbody.ts:28
anchorRigidbodyTail
• anchorRigidbodyTail: Rigidbody
绳索终点处锚定的刚体,设置此项后绳索的终点将与该刚体的位置相同。
Defined in
packages/physics/softbody/RopeSoftbody.ts:33
anchorOffsetHead
• anchorOffsetHead: Vector3
锚点的起点偏移量,表示起点与锚定的刚体之间的相对位置。
Defined in
packages/physics/softbody/RopeSoftbody.ts:38
anchorOffsetTail
• anchorOffsetTail: Vector3
锚点的终点偏移量,表示终点与锚定的刚体之间的相对位置。
Defined in
packages/physics/softbody/RopeSoftbody.ts:43
mass
• mass: number = 1
软体的总质量,默认值为 1
Inherited from
SoftbodyBase.mass
Defined in
packages/physics/softbody/SoftbodyBase.ts:17
margin
• margin: number = 0.15
碰撞边距,默认值为 0.15
Inherited from
SoftbodyBase.margin
Defined in
packages/physics/softbody/SoftbodyBase.ts:22
group
• group: number = 1
碰撞组,默认值为 1
Inherited from
SoftbodyBase.group
Defined in
packages/physics/softbody/SoftbodyBase.ts:27
mask
• mask: number = -1
碰撞掩码,默认值为 -1
Inherited from
SoftbodyBase.mask
Defined in
packages/physics/softbody/SoftbodyBase.ts:32
influence
• influence: number = 1
锚点的影响力。影响力值越大,软体节点越紧密地跟随刚体的运动。通常,这个值在0到1之间。默认值为 1。
Inherited from
SoftbodyBase.influence
Defined in
packages/physics/softbody/SoftbodyBase.ts:37
disableCollision
• disableCollision: boolean = false
是否禁用与锚定刚体之间的碰撞,默认值为 false。
Inherited from
SoftbodyBase.disableCollision
Defined in
packages/physics/softbody/SoftbodyBase.ts:42
object3D
• object3D: Object3D = null
owner object3D
Inherited from
SoftbodyBase.object3D
Defined in
src/components/ComponentBase.ts:17
isDestroyed
• Optional isDestroyed: boolean
Inherited from
SoftbodyBase.isDestroyed
Defined in
src/components/ComponentBase.ts:38
Accessors
activationState
• set activationState(value): void
设置软体激活状态。
Parameters
| Name | Type |
|---|---|
value | ActivationState |
Returns
void
Inherited from
SoftbodyBase.activationState
Defined in
packages/physics/softbody/SoftbodyBase.ts:47
btBodyInited
• get btBodyInited(): boolean
Returns
boolean
Inherited from
SoftbodyBase.btBodyInited
Defined in
packages/physics/softbody/SoftbodyBase.ts:51
btSoftBody
• get btSoftBody(): btSoftBody
Returns
Inherited from
SoftbodyBase.btSoftBody
Defined in
packages/physics/softbody/SoftbodyBase.ts:55
eventDispatcher
• get eventDispatcher(): CEventDispatcher
Returns
CEventDispatcher
Inherited from
SoftbodyBase.eventDispatcher
Defined in
src/components/ComponentBase.ts:23
• set eventDispatcher(value): void
Parameters
| Name | Type |
|---|---|
value | CEventDispatcher |
Returns
void
Inherited from
SoftbodyBase.eventDispatcher
Defined in
src/components/ComponentBase.ts:28
isStart
• get isStart(): boolean
Returns
boolean
Inherited from
SoftbodyBase.isStart
Defined in
src/components/ComponentBase.ts:40
transform
• get transform(): Transform
Return the Transform component attached to the Object3D.
Returns
Transform
Inherited from
SoftbodyBase.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
SoftbodyBase.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
| Name | Type |
|---|---|
value | boolean |
Returns
void
Inherited from
SoftbodyBase.enable
Defined in
src/components/ComponentBase.ts:54
Methods
buildRopeGeometry
▸ buildRopeGeometry(segmentCount, startPos, endPos): GeometryBase
构建绳索(线条)几何体,注意添加材质时需要将拓扑结构 topology 设置为 'line-list'。
Parameters
| Name | Type | Description |
|---|---|---|
segmentCount | number | 分段数 |
startPos | Vector3 | 起点 |
endPos | Vector3 | 终点 |
Returns
GeometryBase
GeometryBase
Defined in
packages/physics/softbody/RopeSoftbody.ts:163
start
▸ start(): Promise<void>
Returns
Promise<void>
Overrides
SoftbodyBase.start
Defined in
packages/physics/softbody/RopeSoftbody.ts:48
setElasticity
▸ setElasticity(value): void
set rope elasticity to 0~1
Parameters
| Name | Type |
|---|---|
value | number |
Returns
void
Defined in
packages/physics/softbody/RopeSoftbody.ts:110
clearAnchors
▸ clearAnchors(isPopBack?): void
清除锚点,软体将会从附加的刚体上脱落
Parameters
| Name | Type | Description |
|---|---|---|
isPopBack? | boolean | 是否只删除一个锚点,当存在首尾两个锚点时,删除终点的锚点。 |
Returns
void
Defined in
packages/physics/softbody/RopeSoftbody.ts:123
onUpdate
▸ onUpdate(): void
Returns
void
Overrides
SoftbodyBase.onUpdate
Defined in
packages/physics/softbody/RopeSoftbody.ts:131
destroy
▸ destroy(force?): void
Parameters
| Name | Type |
|---|---|
force? | boolean |
Returns
void
Overrides
SoftbodyBase.destroy
Defined in
packages/physics/softbody/RopeSoftbody.ts:150
init
▸ init(): void
Returns
void
Inherited from
SoftbodyBase.init
Defined in
packages/physics/softbody/SoftbodyBase.ts:59
wait
▸ wait(): Promise<btSoftBody>
Asynchronously retrieves the fully initialized soft body instance.
Returns
Promise<btSoftBody>
Inherited from
SoftbodyBase.wait
Defined in
packages/physics/softbody/SoftbodyBase.ts:95
appendAnchor
▸ appendAnchor(nodeIndex, targetRigidbody, disCollision?, influence?): void
Wraps the native soft body's appendAnchor method to anchor a node to a rigid body.
Parameters
| Name | Type | Description |
|---|---|---|
nodeIndex | number | Index of the node to anchor. |
targetRigidbody | Rigidbody | The rigid body to anchor to. |
disCollision? | boolean | Optional. Disable collisions if true. |
influence? | number | Optional. Anchor's influence. |
Returns
void
Inherited from
SoftbodyBase.appendAnchor
Defined in
packages/physics/softbody/SoftbodyBase.ts:107
applyFixedNodes
▸ applyFixedNodes(fixedNodeIndices): void
固定软体节点。
Parameters
| Name | Type | Description |
|---|---|---|
fixedNodeIndices | number[] | 需要固定的节点索引。 |
Returns
void
Inherited from
SoftbodyBase.applyFixedNodes
Defined in
packages/physics/softbody/SoftbodyBase.ts:121
clearFixedNodes
▸ clearFixedNodes(index?): void
清除固定节点
Parameters
| Name | Type | Description |
|---|---|---|
index? | number | 需要清除的节点索引,如果未提供,则清除所有节点。 |
Returns
void
Inherited from
SoftbodyBase.clearFixedNodes
Defined in
packages/physics/softbody/SoftbodyBase.ts:140
stop
▸ stop(): void
Returns
void
Inherited from
SoftbodyBase.stop
Defined in
src/components/ComponentBase.ts:114
onEnable
▸ onEnable(view?): any
Parameters
| Name | Type |
|---|---|
view? | View3D |
Returns
any
Inherited from
SoftbodyBase.onEnable
Defined in
src/components/ComponentBase.ts:115
onDisable
▸ onDisable(view?): any
Parameters
| Name | Type |
|---|---|
view? | View3D |
Returns
any
Inherited from
SoftbodyBase.onDisable
Defined in
src/components/ComponentBase.ts:116
onLateUpdate
▸ onLateUpdate(view?): any
Parameters
| Name | Type |
|---|---|
view? | View3D |
Returns
any
Inherited from
SoftbodyBase.onLateUpdate
Defined in
src/components/ComponentBase.ts:118
onBeforeUpdate
▸ onBeforeUpdate(view?): any
Parameters
| Name | Type |
|---|---|
view? | View3D |
Returns
any
Inherited from
SoftbodyBase.onBeforeUpdate
Defined in
src/components/ComponentBase.ts:119
onCompute
▸ onCompute(view?, command?): any
Parameters
| Name | Type |
|---|---|
view? | View3D |
command? | GPUCommandEncoder |
Returns
any
Inherited from
SoftbodyBase.onCompute
Defined in
src/components/ComponentBase.ts:120
onGraphic
▸ onGraphic(view?): any
Parameters
| Name | Type |
|---|---|
view? | View3D |
Returns
any
Inherited from
SoftbodyBase.onGraphic
Defined in
src/components/ComponentBase.ts:121
onParentChange
▸ onParentChange(lastParent?, currentParent?): any
Parameters
| Name | Type |
|---|---|
lastParent? | Object3D |
currentParent? | Object3D |
Returns
any
Inherited from
SoftbodyBase.onParentChange
Defined in
src/components/ComponentBase.ts:122
onAddChild
▸ onAddChild(child): any
Parameters
| Name | Type |
|---|---|
child | Object3D |
Returns
any
Inherited from
SoftbodyBase.onAddChild
Defined in
src/components/ComponentBase.ts:123
onRemoveChild
▸ onRemoveChild(child): any
Parameters
| Name | Type |
|---|---|
child | Object3D |
Returns
any
Inherited from
SoftbodyBase.onRemoveChild
Defined in
src/components/ComponentBase.ts:124
cloneTo
▸ cloneTo(obj): void
clone component data to target object3D
Parameters
| Name | Type | Description |
|---|---|---|
obj | Object3D | target object3D |
Returns
void
Inherited from
SoftbodyBase.cloneTo
Defined in
src/components/ComponentBase.ts:131
copyComponent
▸ copyComponent(from): this
Parameters
| Name | Type |
|---|---|
from | this |
Returns
this
Inherited from
SoftbodyBase.copyComponent
Defined in
src/components/ComponentBase.ts:133
beforeDestroy
▸ beforeDestroy(force?): void
before release this component, object refrences are not be set null now.
Parameters
| Name | Type |
|---|---|
force? | boolean |
Returns
void
Inherited from
SoftbodyBase.beforeDestroy

