Skip to content

editorGlobalsCollisionSoundAddOn

Class: CollisionSoundAddOn

Hierarchy

CollisionSoundAddOn

Index

Constructors

Properties

Methods

Constructors

constructor

+ new CollisionSoundAddOn(threeNode: Object3D, renderContext: RenderContext): CollisionSoundAddOn

Overrides PhysicsAddOn.constructor

Defined in src/physics/addOns/CollisionSoundAddOn.ts:13

Parameters:

Name Type
threeNode Object3D
renderContext RenderContext

Returns: CollisionSoundAddOn

Properties

Protected compositeModel

compositeModel: CompositeModel

Inherited from PhysicsAddOn.compositeModel

Defined in src/physics/addOns/PhysicsAddOn.ts:15


Private materialBehaviour

materialBehaviour: MaterialBehaviour‹› = new MaterialBehaviour()

Defined in src/physics/addOns/CollisionSoundAddOn.ts:13


Protected modelSubnode

modelSubnode: Object3D

Inherited from PhysicsAddOn.modelSubnode

Defined in src/physics/addOns/PhysicsAddOn.ts:11


Protected physicsContext

physicsContext: PhysicsContext

Inherited from PhysicsAddOn.physicsContext

Defined in src/physics/addOns/PhysicsAddOn.ts:14


Protected renderContext

renderContext: RenderContext

Inherited from PhysicsAddOn.renderContext

Defined in src/physics/addOns/PhysicsAddOn.ts:12


Private soundIsPlaying

soundIsPlaying: boolean = false

Defined in src/physics/addOns/CollisionSoundAddOn.ts:12


Protected threeNode

threeNode: Object3D = null

Inherited from PhysicsAddOn.threeNode

Defined in src/physics/addOns/PhysicsAddOn.ts:13

Methods

Private _addCollisionListenerToObject

_addCollisionListenerToObject(body: any): void

Defined in src/physics/addOns/CollisionSoundAddOn.ts:49

Adds the collision event listener to the body.

Parameters:

Name Type
body any

Returns: void


Private _deregisterPhysicsContextListeners

_deregisterPhysicsContextListeners(): void

Defined in src/physics/addOns/CollisionSoundAddOn.ts:39

Returns: void


Private _getClosestPhysicalObject

_getClosestPhysicalObject(physicalObjects: PhysicalObject[], worldPosition: Vector3): PhysicalObject‹›

Defined in src/physics/addOns/CollisionSoundAddOn.ts:119

Parameters:

Name Type
physicalObjects PhysicalObject[]
worldPosition Vector3

Returns: PhysicalObject‹›


Private _getPhysicalObjects

_getPhysicalObjects(shape: any): PhysicalObject[]

Defined in src/physics/addOns/CollisionSoundAddOn.ts:109

Parameters:

Name Type
shape any

Returns: PhysicalObject[]


Private _objectSoundCollision

_objectSoundCollision(event: any): void

Defined in src/physics/addOns/CollisionSoundAddOn.ts:77

This function we want to call when the collide event occurs. Decides which one is the plane and which one is the collision object.

Parameters:

Name Type
event any

Returns: void


Private _playSound

_playSound(sound: string, volume: number, position: Vector3): void

Defined in src/physics/addOns/CollisionSoundAddOn.ts:130

Parameters:

Name Type
sound string
volume number
position Vector3

Returns: void


Private _removeCollisionListenerFromObject

_removeCollisionListenerFromObject(body: any): void

Defined in src/physics/addOns/CollisionSoundAddOn.ts:69

Removes the collision event listener from the body.

Parameters:

Name Type
body any

Returns: void


destroy

destroy(): void

Overrides PhysicsAddOn.destroy

Defined in src/physics/addOns/CollisionSoundAddOn.ts:34

Returns: void


getName

getName(): string

Overrides PhysicsAddOn.getName

Defined in src/physics/addOns/CollisionSoundAddOn.ts:21

Returns: string


getPriority

getPriority(): number

Inherited from PhysicsAddOn.getPriority

Defined in src/physics/addOns/PhysicsAddOn.ts:32

enforce a certain rendering and physics-step order. AddOns with higher priority will be rendered & executed before AddOns with a lower priority

Returns: number


getThreeNode

getThreeNode(): Object3D

Inherited from PhysicsAddOn.getThreeNode

Defined in src/physics/addOns/PhysicsAddOn.ts:68

Returns: Object3D


initializeCompositeModel

initializeCompositeModel(compositeModel: CompositeModel): void

Inherited from PhysicsAddOn.initializeCompositeModel

Defined in src/physics/addOns/PhysicsAddOn.ts:86

You should override this method to be notified when the compositeModel is set. This may be called multiple times during the lifecycle of an AddOn with different parameters.

Parameters:

Name Type Description
compositeModel CompositeModel the compositeModel, guaranteed to not be null or undefined

Returns: void


initializeThreeNode

initializeThreeNode(threeNode: Object3D): void

Inherited from PhysicsAddOn.initializeThreeNode

Defined in src/physics/addOns/PhysicsAddOn.ts:77

You should override this method to set up the scene. Create all the objects you need and add() them to threeNode.

Parameters:

Name Type Description
threeNode Object3D the parent node

Returns: void


render

render(): void

Inherited from PhysicsAddOn.render

Defined in src/physics/addOns/PhysicsAddOn.ts:50

Update the view with the new values calculated in step.

Returns: void


requiresContinuousRendering

requiresContinuousRendering(): boolean

Inherited from PhysicsAddOn.requiresContinuousRendering

Defined in src/physics/addOns/PhysicsAddOn.ts:104

Returns: boolean


setCompositeModel

setCompositeModel(compositeModel: CompositeModel): void

Inherited from PhysicsAddOn.setCompositeModel

Defined in src/physics/addOns/PhysicsAddOn.ts:63

Parameters:

Name Type
compositeModel CompositeModel

Returns: void


setPhysicsContext

setPhysicsContext(physicsContext: PhysicsContext): void

Overrides PhysicsAddOn.setPhysicsContext

Defined in src/physics/addOns/CollisionSoundAddOn.ts:25

Parameters:

Name Type
physicsContext PhysicsContext

Returns: void


setThreeNode

setThreeNode(threeNode: Object3D): void

Inherited from PhysicsAddOn.setThreeNode

Defined in src/physics/addOns/PhysicsAddOn.ts:54

Parameters:

Name Type
threeNode Object3D

Returns: void


step

step(elapsedTime: number): void

Inherited from PhysicsAddOn.step

Defined in src/physics/addOns/PhysicsAddOn.ts:43

Advance the simulation by elapsedTime. Hint: Do not update the view in this method, because this might be called multiple times per rendered frame.

Parameters:

Name Type Description
elapsedTime number the time delta in seconds

Returns: void


updateSiblings

updateSiblings(addOns: PhysicsAddOn[]): void

Inherited from PhysicsAddOn.updateSiblings

Defined in src/physics/addOns/PhysicsAddOn.ts:100

This is called when the physics addOns change to allow interaction between addOns.

Parameters:

Name Type
addOns PhysicsAddOn[]

Returns: void