Skip to content

editor › Globals › AssemblyPhysicsRepresentation

Class: AssemblyPhysicsRepresentation

This class creates a simple representation for an assembly. It returns just the assembly's bounding box as one CANNON.Box.

Hierarchy

↳ AssemblyPhysicsRepresentation

Index

Constructors

Properties

Methods

Constructors

constructor

+ new AssemblyPhysicsRepresentation(assembly: Assembly): AssemblyPhysicsRepresentation

Overrides AssemblyRepresentation.constructor

Defined in src/model/physics/representations/AssemblyPhysicsRepresentation.ts:49

Parameters:

Name Type
assembly Assembly

Returns: AssemblyPhysicsRepresentation

Properties

Protected assembly

• assembly: Assembly

Inherited from AssemblyRepresentation.assembly

Defined in src/model/AssemblyRepresentation.ts:9


Private assemblyCenterOfGravity

• assemblyCenterOfGravity: Vector3‹› = new Vector3()

Defined in src/model/physics/representations/AssemblyPhysicsRepresentation.ts:44


Private body

• body: CANNON.Body

Defined in src/model/physics/representations/AssemblyPhysicsRepresentation.ts:41


Private fixateAssemblyInPhysicsEngine

• fixateAssemblyInPhysicsEngine: boolean

Defined in src/model/physics/representations/AssemblyPhysicsRepresentation.ts:40


Private invScaleFactor

• invScaleFactor: number = 0

Defined in src/model/physics/representations/AssemblyPhysicsRepresentation.ts:49


Protected objectToRepresentationsWrapper

• objectToRepresentationsWrapper: Map‹PhysicalObject, PhysicsRepresentationWrapper› = new Map< PhysicalObject, RepresentationWrapper

()

Inherited from AssemblyRepresentation.objectToRepresentationsWrapper

Defined in src/model/AssemblyRepresentation.ts:10


Private scaleFactor

• scaleFactor: number = 0

Defined in src/model/physics/representations/AssemblyPhysicsRepresentation.ts:46


Static availableObjectRepresentations

▪ availableObjectRepresentations: any[] = [ require("../representations/PlateRepresentation").default, require("../representations/ExternalObjectRepresentation").default, require("../representations/DummyMeshRepresentation").default, require("../../../tools/ikeaTool/IkeaPhysicsRepresentation"), require("../../../modules/kyub.core.truss/src/PhysicsRepresentation/StrawbeeHubRepresentation"), require("../../../modules/kyub.core.truss/src/PhysicsRepresentation/System180HubRepresentation"), require("../../../modules/kyub.core.truss/src/PhysicsRepresentation/StrawRepresentation"), require("../../../modules/kyub.core.truss/src/PhysicsRepresentation/System180RodRepresentation"), require("../../../modules/kyub.core.truss/src/PhysicsRepresentation/HiddenSurfaceRepresentation"), require("../../../modules/kyub.core.truss/src/PhysicsRepresentation/CoverRepresentation"), ]

Defined in src/model/physics/representations/AssemblyPhysicsRepresentation.ts:25


Static Private tempQuaternion1

▪ tempQuaternion1: Quaternion‹› = new Quaternion()

Defined in src/model/physics/representations/AssemblyPhysicsRepresentation.ts:38


Static Private tempVector1

▪ tempVector1: Vector3‹› = new Vector3()

Defined in src/model/physics/representations/AssemblyPhysicsRepresentation.ts:37

Methods

Private _addShapesToBody

▸ _addShapesToBody(shapesAndMasses: PhysicsRepresentationWrapper): void

Defined in src/model/physics/representations/AssemblyPhysicsRepresentation.ts:210

Parameters:

Name Type
shapesAndMasses PhysicsRepresentationWrapper

Returns: void


_createObjectRepresentations

▸ _createObjectRepresentations(physicalObject: PhysicalObject): PhysicsRepresentationWrapper

Overrides AssemblyRepresentation._createObjectRepresentations

Defined in src/model/physics/representations/AssemblyPhysicsRepresentation.ts:152

Parameters:

Name Type
physicalObject PhysicalObject

Returns: PhysicsRepresentationWrapper


_destroyObjectRepresentation

▸ _destroyObjectRepresentation(wrapper: PhysicsRepresentationWrapper): void

Overrides AssemblyRepresentation._destroyObjectRepresentation

Defined in src/model/physics/representations/AssemblyPhysicsRepresentation.ts:170

Parameters:

Name Type
wrapper PhysicsRepresentationWrapper

Returns: void


Private _getAssemblyPosition

▸ _getAssemblyPosition(localPosition: Vector3, physicalObject: PhysicalObject): Vector3

Defined in src/model/physics/representations/AssemblyPhysicsRepresentation.ts:292

Parameters:

Name Type
localPosition Vector3
physicalObject PhysicalObject

Returns: Vector3


_getObjectRepresentationDirty

▸ _getObjectRepresentationDirty(physicalObject: PhysicalObject): boolean

Overrides AssemblyRepresentation._getObjectRepresentationDirty

Defined in src/model/physics/representations/AssemblyPhysicsRepresentation.ts:191

Parameters:

Name Type
physicalObject PhysicalObject

Returns: boolean


_getObjectRepresentationTransformsDirty

▸ _getObjectRepresentationTransformsDirty(physicalObject: PhysicalObject): boolean

Overrides AssemblyRepresentation._getObjectRepresentationTransformsDirty

Defined in src/model/physics/representations/AssemblyPhysicsRepresentation.ts:198

Parameters:

Name Type
physicalObject PhysicalObject

Returns: boolean


Private _moveCenterOfGravity

▸ _moveCenterOfGravity(oldCenterOfGravity: Vector3, newCenterOfGravity: Vector3): void

Defined in src/model/physics/representations/AssemblyPhysicsRepresentation.ts:303

Parameters:

Name Type
oldCenterOfGravity Vector3
newCenterOfGravity Vector3

Returns: void


Protected _preUpdateCallback

▸ _preUpdateCallback(addedObjects: Set‹PhysicalObject›, changedObjects: Set‹PhysicalObject›): Set‹PhysicalObject›

Inherited from AssemblyRepresentation._preUpdateCallback

Defined in src/model/AssemblyRepresentation.ts:178

This callback can be used to work on all objects that changed since the last update and optionally change the set of changedObjects.

Parameters:

Name Type
addedObjects Set‹PhysicalObject›
changedObjects Set‹PhysicalObject›

Returns: Set‹PhysicalObject›


_resetObjectRepresentationDirty

▸ _resetObjectRepresentationDirty(physicalObject: PhysicalObject): boolean

Overrides AssemblyRepresentation._resetObjectRepresentationDirty

Defined in src/model/physics/representations/AssemblyPhysicsRepresentation.ts:195

Parameters:

Name Type
physicalObject PhysicalObject

Returns: boolean


_resetObjectRepresentationTransformsDirty

▸ _resetObjectRepresentationTransformsDirty(physicalObject: PhysicalObject): boolean

Overrides AssemblyRepresentation._resetObjectRepresentationTransformsDirty

Defined in src/model/physics/representations/AssemblyPhysicsRepresentation.ts:201

Parameters:

Name Type
physicalObject PhysicalObject

Returns: boolean


Private _setScaleFactor

▸ _setScaleFactor(scaleFactor: number): void

Defined in src/model/physics/representations/AssemblyPhysicsRepresentation.ts:205

Parameters:

Name Type
scaleFactor number

Returns: void


Private _shouldUpdate

▸ _shouldUpdate(assembly: Assembly, physicsBody: CANNON.Body, position: Vector3, rotation: Quaternion): boolean

Defined in src/model/physics/representations/AssemblyPhysicsRepresentation.ts:249

Parameters:

Name Type
assembly Assembly
physicsBody CANNON.Body
position Vector3
rotation Quaternion

Returns: boolean


Private _updateCenterOfGravity

▸ _updateCenterOfGravity(): boolean

Defined in src/model/physics/representations/AssemblyPhysicsRepresentation.ts:263

Returns: boolean


Private _updateFixationInPhysicsEngine

▸ _updateFixationInPhysicsEngine(): boolean

Defined in src/model/physics/representations/AssemblyPhysicsRepresentation.ts:317

Returns: boolean


Protected _updateObjectRepresentations

▸ _updateObjectRepresentations(representationsWrapper: PhysicsRepresentationWrapper, physicalObject: PhysicalObject): PhysicsRepresentationWrapper

Inherited from AssemblyRepresentation._updateObjectRepresentations

Defined in src/model/AssemblyRepresentation.ts:161

Updates the representations contained in the representationsWrapper Default behavior is to recreate the representation.

Parameters:

Name Type
representationsWrapper PhysicsRepresentationWrapper
physicalObject PhysicalObject

Returns: PhysicsRepresentationWrapper


_updateObjectTransformations

▸ _updateObjectTransformations(wrapper: PhysicsRepresentationWrapper, physicalObject: PhysicalObject): void

Overrides AssemblyRepresentation._updateObjectTransformations

Defined in src/model/physics/representations/AssemblyPhysicsRepresentation.ts:184

Parameters:

Name Type
wrapper PhysicsRepresentationWrapper
physicalObject PhysicalObject

Returns: void


Private _updateShapeTransformations

▸ _updateShapeTransformations(shape: CANNON.Shape, localPosition: Vector3, localRotation: Quaternion, physicalObject: PhysicalObject): void

Defined in src/model/physics/representations/AssemblyPhysicsRepresentation.ts:220

Parameters:

Name Type
shape CANNON.Shape
localPosition Vector3
localRotation Quaternion
physicalObject PhysicalObject

Returns: void


destroy

▸ destroy(): void

Overrides AssemblyRepresentation.destroy

Defined in src/model/physics/representations/AssemblyPhysicsRepresentation.ts:111

Returns: void


getAssembly

▸ getAssembly(): Assembly

Inherited from AssemblyRepresentation.getAssembly

Defined in src/model/AssemblyRepresentation.ts:99

Returns: Assembly


getBody

▸ getBody(): CANNON.Body

Defined in src/model/physics/representations/AssemblyPhysicsRepresentation.ts:87

Returns: CANNON.Body


getObjectRepresentation

▸ getObjectRepresentation(physicalObject: PhysicalObject): PhysicsRepresentationWrapper

Inherited from AssemblyRepresentation.getObjectRepresentation

Defined in src/model/AssemblyRepresentation.ts:103

Parameters:

Name Type
physicalObject PhysicalObject

Returns: PhysicsRepresentationWrapper


getRepresentationFinishedPromise

▸ getRepresentationFinishedPromise(): Promise‹void›

Inherited from AssemblyRepresentation.getRepresentationFinishedPromise

Defined in src/model/AssemblyRepresentation.ts:95

Returns: Promise‹void›


reset

▸ reset(): void

Overrides AssemblyRepresentation.reset

Defined in src/model/physics/representations/AssemblyPhysicsRepresentation.ts:103

Returns: void


updateAssemblyRepresentation

▸ updateAssemblyRepresentation(): boolean

Overrides AssemblyRepresentation.updateAssemblyRepresentation

Defined in src/model/physics/representations/AssemblyPhysicsRepresentation.ts:91

Returns: boolean


updateAssemblyTransformations

▸ updateAssemblyTransformations(): void

Overrides AssemblyRepresentation.updateAssemblyTransformations

Defined in src/model/physics/representations/AssemblyPhysicsRepresentation.ts:116

Returns: void


updateAssemblyTransformsFromPhysics

▸ updateAssemblyTransformsFromPhysics(): void

Defined in src/model/physics/representations/AssemblyPhysicsRepresentation.ts:130

Returns: void