TransformObjectComponent3D
Summary
This component handles the transformation (rotation/translation) of every mesh on the scene. This conveniently provides an history of tranformations, especially when the user moves an object from point A to point B, travelling around the whole scene - (It merges translations and rotation into a resultant one).
Constructor
TransformObjectComponent3D
Syntax
TransformObjectComponent3D
-
core
Summary
Parameters:
-
core
wnp.CoreWanaplan.
Item Index
Methods
Properties
Methods
beginTransformObject
Syntax
beginTransformObject
-
object
-
[options]
Summary
Notifies that the object is getting transformed a lot with small deltas. The transformation applied after will be summarized and notified when calling endTransformObject.
compute
Syntax
compute
()
private
Summary
Recompute of the component.destroy
Syntax
destroy
()
Summary
Destructor.disable
Syntax
disable
()
Summary
Disables the componentenable
Syntax
enable
()
Summary
Enables the componentendTransformObject
Syntax
endTransformObject
-
object
-
[options]
Summary
Notifies that the object will not longer be transformed.
The transformation which occured since the last beginTransformObject will be merged, notified and historized.
getFloor
Syntax
getFloor
-
[structure]
Summary
Gets the 3D mesh of the floor structure in parameter (by default current floor).Parameters:
-
[structure]
FloorStructure optionalThe floor structure.
Returns:
The floor mesh in 3D.
initialize
Syntax
initialize
()
Summary
Method called when Wanaplan is initialized. You don't need to call this method manually.moveObject
Syntax
moveObject
-
object
-
newPosition
-
[options]
Summary
Moves the object on the scene.
Parameters:
-
object
BABYLON.MeshThe object, can be a group.
-
newPosition
BABYLON.Vector3The new position.
-
[options]
Object optionalOptions.
-
[history=false]
Boolean optionalIf set to true, the transformation will be saved into the history.
-
[silent=false]
Boolean optionalIf set to true, no event
wnp.engine3D.object.translate
will be fired. -
[old]
BABYLON.Vector3 optionalThe former position for the transform. By default, it is the current position.
-
onContextChanged
Syntax
onContextChanged
-
context
Summary
Method called when the context is switched (2D -> 3D or 3D -> 2D)Parameters:
-
context
StringThe new context
rotateObject
Syntax
rotateObject
-
object
-
newRotation
-
[options]
Summary
Rotates the object on the scene.
Parameters:
-
object
BABYLON.MeshThe object, can be a group.
-
newRotation
BABYLON.Vector3The new rotation
-
[options]
Object optionalOptions.
-
[history=false]
Boolean optionalIf set to true, the transformation will be saved into the history.
-
[silent=false]
Boolean optionalIf set to true, no event
wnp.engine3D.object.rotated
will be fired. -
[old]
BABYLON.Vector3 optionalThe former rotation for the transform. By default, it is the current rotation.
-
startListening
Syntax
startListening
()
Summary
Calls all the event listeners.stopListening
Syntax
stopListening
()
Summary
Removes all the event listeners.update
Syntax
update
-
deltaTime
Summary
Updates the dynamic part of the component.Parameters:
-
deltaTime
NumberThe time interval.
Properties
keyboardManager
Syntax
keyboardManager
wnp.KeyboardManager
Summary
Instance of the Keyboard Manager (shortcut to wanaplan.keyboardManager).structure
Syntax
structure
wnp.Structure
Summary
Instance of the structure (shortcut to wanaplan.structure).Events
wnp.engine3D.object.end-transform
Syntax
wnp.engine3D.object.end-transform
Summary
Fired when the TransformComponent ends to transform the position/rotation of an object.
Event Payload:
-
object
BABYLON.MeshThe involved object.
wnp.engine3D.object.rotated
Syntax
wnp.engine3D.object.rotated
Summary
Fired when the TransformComponent just rotated an object on the scene.
Event Payload:
-
object
BABYLON.MeshThe involved object.
-
pending
BooleanTrue if the TransformComponent is currently waiting for the end of the transformation to notify and set up the history.
-
newValue
BABLYON.Vector3The new rotation of the object.
wnp.engine3D.object.start-transform
Syntax
wnp.engine3D.object.start-transform
Summary
Fired when the TransformComponent begins to transform the position/rotation of an object.
This will be followed by a wnp.engine3D.object.end-transform
event.
Event Payload:
-
object
BABYLON.MeshThe involved object.
wnp.engine3D.object.translate
Syntax
wnp.engine3D.object.translate
Summary
Fired when the TransformComponent just translated an object on the scene.
Event Payload:
-
object
BABYLON.MeshThe involved object.
-
pending
BooleanTrue if the TransformComponent is currently waiting for the end of the transformation to notify and set up the history.
-
newValue
BABLYON.Vector3The new position of the object.