Skip to content

@orillusion/physics


Class: GhostTrigger ​

Defined in: packages/physics/rigidbody/GhostTrigger.ts:11

The GhostTrigger Component represents a non-physical trigger in the physics world. It uses a ghost object to detect overlapping collisions without producing physical responses.

Extends ​

  • ComponentBase

Constructors ​

Constructor ​

new GhostTrigger(): GhostTrigger

Returns ​

GhostTrigger

Inherited from ​

ComponentBase.constructor

Properties ​

object3D ​

object3D: Object3D = null

Defined in: src/components/ComponentBase.ts:29

owner object3D

Inherited from ​

ComponentBase.object3D


isDestroyed ​

isDestroyed: boolean = false

Defined in: src/components/ComponentBase.ts:77

Inherited from ​

ComponentBase.isDestroyed

Accessors ​

visibleLayer ​

Get Signature ​

get visibleLayer(): number

Defined in: src/components/ComponentBase.ts:46

Composition-layer membership bitmask. The pass / camera / collector filters via

(component.visibleLayer & pass.layerMask & camera.cullingMask) !== 0

Defaults to VisibleLayer.Default (bit 0) so a fresh subclass is visible to passes whose layerMask is VisibleLayer.All (which includes bit 0). Application code can assign project-specific bits (1..31) to organise the scene into composition layers.

Returns ​

number

Set Signature ​

set visibleLayer(value): void

Defined in: src/components/ComponentBase.ts:50

Parameters ​
value ​

number

Returns ​

void

Inherited from ​

ComponentBase.visibleLayer


eventDispatcher ​

Get Signature ​

get eventDispatcher(): CEventDispatcher

Defined in: src/components/ComponentBase.ts:63

Returns ​

CEventDispatcher

Set Signature ​

set eventDispatcher(value): void

Defined in: src/components/ComponentBase.ts:68

Parameters ​
value ​

CEventDispatcher

Returns ​

void

Inherited from ​

ComponentBase.eventDispatcher


isStart ​

Get Signature ​

get isStart(): boolean

Defined in: src/components/ComponentBase.ts:79

Returns ​

boolean

Inherited from ​

ComponentBase.isStart


transform ​

Get Signature ​

get transform(): Transform

Defined in: src/components/ComponentBase.ts:89

Return the Transform component attached to the Object3D. Null before the component is attached — addComponent assigns object3D only after construction — so constructor-time callers can probe safely via this.transform?..

Returns ​

Transform

Inherited from ​

ComponentBase.transform


enable ​

Get Signature ​

get enable(): boolean

Defined in: src/components/ComponentBase.ts:113

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

Returns ​

boolean

Set Signature ​

set enable(value): void

Defined in: src/components/ComponentBase.ts:96

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

Parameters ​
value ​

boolean

Returns ​

void

Inherited from ​

ComponentBase.enable


shape ​

Get Signature ​

get shape(): btCollisionShape

Defined in: packages/physics/rigidbody/GhostTrigger.ts:19

Returns ​

btCollisionShape

Set Signature ​

set shape(value): void

Defined in: packages/physics/rigidbody/GhostTrigger.ts:22

Parameters ​
value ​

btCollisionShape

Returns ​

void


userIndex ​

Get Signature ​

get userIndex(): number

Defined in: packages/physics/rigidbody/GhostTrigger.ts:31

Returns ​

number

Set Signature ​

set userIndex(value): void

Defined in: packages/physics/rigidbody/GhostTrigger.ts:35

Parameters ​
value ​

number

Returns ​

void


collisionFlags ​

Get Signature ​

get collisionFlags(): number

Defined in: packages/physics/rigidbody/GhostTrigger.ts:45

Gets the collision flags

Returns ​

number


ghostObject ​

Get Signature ​

get ghostObject(): btPairCachingGhostObject

Defined in: packages/physics/rigidbody/GhostTrigger.ts:129

Gets the ghost object

Returns ​

btPairCachingGhostObject


enableCollisionEvent ​

Get Signature ​

get enableCollisionEvent(): boolean

Defined in: packages/physics/rigidbody/GhostTrigger.ts:144

Enable/disable collision callbacks

Returns ​

boolean

Set Signature ​

set enableCollisionEvent(value): void

Defined in: packages/physics/rigidbody/GhostTrigger.ts:147

Parameters ​
value ​

boolean

Returns ​

void


collisionEvent ​

Get Signature ​

get collisionEvent(): (contactPoint, selfBody, otherBody) => void

Defined in: packages/physics/rigidbody/GhostTrigger.ts:155

Collision event callback

Returns ​

(contactPoint, selfBody, otherBody) => void

Set Signature ​

set collisionEvent(callback): void

Defined in: packages/physics/rigidbody/GhostTrigger.ts:158

Parameters ​
callback ​

(contactPoint, selfBody, otherBody) => void

Returns ​

void

Methods ​

createAndAddGhostObject() ​

static createAndAddGhostObject(shape, position, rotation, collisionFlags?, userIndex?): btPairCachingGhostObject

Defined in: packages/physics/rigidbody/GhostTrigger.ts:103

Creates a ghost object and adds it to the physics world.

Parameters ​

shape ​

btCollisionShape

The collision shape.

position ​

Vector3

The position of the ghost object.

rotation ​

Vector3

The rotation of the ghost object.

collisionFlags? ​

number

Optional parameter, collision flags; defaults to 4 NO_CONTACT_RESPONSE, meaning the object does not participate in collision response but still triggers collision events.

userIndex? ​

number

Optional parameter, user index that can serve as an identifier for the physics object.

Returns ​

btPairCachingGhostObject

The newly created Ammo.btPairCachingGhostObject.


init() ​

init(param?): void

Defined in: src/components/ComponentBase.ts:161

Parameters ​

param? ​

any

Returns ​

void

Inherited from ​

ComponentBase.init


stop() ​

stop(): void

Defined in: src/components/ComponentBase.ts:163

Returns ​

void

Inherited from ​

ComponentBase.stop


onEnable()? ​

optional onEnable(view?): any

Defined in: src/components/ComponentBase.ts:164

Parameters ​

view? ​

View3D

Returns ​

any

Inherited from ​

ComponentBase.onEnable


onDisable()? ​

optional onDisable(view?): any

Defined in: src/components/ComponentBase.ts:165

Parameters ​

view? ​

View3D

Returns ​

any

Inherited from ​

ComponentBase.onDisable


onUpdate()? ​

optional onUpdate(view?): any

Defined in: src/components/ComponentBase.ts:166

Parameters ​

view? ​

View3D

Returns ​

any

Inherited from ​

ComponentBase.onUpdate


onLateUpdate()? ​

optional onLateUpdate(view?): any

Defined in: src/components/ComponentBase.ts:167

Parameters ​

view? ​

View3D

Returns ​

any

Inherited from ​

ComponentBase.onLateUpdate


onBeforeUpdate()? ​

optional onBeforeUpdate(view?): any

Defined in: src/components/ComponentBase.ts:168

Parameters ​

view? ​

View3D

Returns ​

any

Inherited from ​

ComponentBase.onBeforeUpdate


onCompute()? ​

optional onCompute(view?, command?): any

Defined in: src/components/ComponentBase.ts:169

Parameters ​

view? ​

View3D

command? ​

GPUCommandEncoder

Returns ​

any

Inherited from ​

ComponentBase.onCompute


onGraphic()? ​

optional onGraphic(view?): any

Defined in: src/components/ComponentBase.ts:170

Parameters ​

view? ​

View3D

Returns ​

any

Inherited from ​

ComponentBase.onGraphic


onParentChange()? ​

optional onParentChange(lastParent?, currentParent?): any

Defined in: src/components/ComponentBase.ts:171

Parameters ​

lastParent? ​

Object3D

currentParent? ​

Object3D

Returns ​

any

Inherited from ​

ComponentBase.onParentChange


onAddChild()? ​

optional onAddChild(child): any

Defined in: src/components/ComponentBase.ts:172

Parameters ​

child ​

Object3D

Returns ​

any

Inherited from ​

ComponentBase.onAddChild


onRemoveChild()? ​

optional onRemoveChild(child): any

Defined in: src/components/ComponentBase.ts:173

Parameters ​

child ​

Object3D

Returns ​

any

Inherited from ​

ComponentBase.onRemoveChild


cloneTo() ​

cloneTo(obj): void

Defined in: src/components/ComponentBase.ts:180

clone component data to target object3D

Parameters ​

obj ​

Object3D

target object3D

Returns ​

void

Inherited from ​

ComponentBase.cloneTo


copyComponent() ​

copyComponent(from): this

Defined in: src/components/ComponentBase.ts:182

Parameters ​

from ​

this

Returns ​

this

Inherited from ​

ComponentBase.copyComponent


beforeDestroy() ​

beforeDestroy(force?): void

Defined in: src/components/ComponentBase.ts:249

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

Parameters ​

force? ​

boolean

Returns ​

void

Inherited from ​

ComponentBase.beforeDestroy


addCollisionFlag() ​

addCollisionFlag(value): void

Defined in: packages/physics/rigidbody/GhostTrigger.ts:52

Adds a single collision flag

Parameters ​

value ​

CollisionFlags

Returns ​

void


removeCollisionFlag() ​

removeCollisionFlag(value): void

Defined in: packages/physics/rigidbody/GhostTrigger.ts:59

Removes a single collision flag

Parameters ​

value ​

CollisionFlags

Returns ​

void


start() ​

start(): Promise<void>

Defined in: packages/physics/rigidbody/GhostTrigger.ts:64

Returns ​

Promise<void>

Overrides ​

ComponentBase.start


wait() ​

wait(): Promise<btPairCachingGhostObject>

Defined in: packages/physics/rigidbody/GhostTrigger.ts:136

Asynchronously retrieves the fully initialized ghost object

Returns ​

Promise<btPairCachingGhostObject>


destroy() ​

destroy(force?): void

Defined in: packages/physics/rigidbody/GhostTrigger.ts:162

release this component

Parameters ​

force? ​

boolean

Returns ​

void

Overrides ​

ComponentBase.destroy

Released under the MIT License