-
Notifications
You must be signed in to change notification settings - Fork 103
SceneObject
The SceneObject class is a container used to represent an object in a Scene. A SceneObject can contain meshes, child SceneObjects or simply be a "Null" pointer or target for reference or animation.
obj_init
may also be simply a Mesh to bind, undefined or null. CubicVR.get functionality is also supported for SceneObject.
Object Constructor:
var mySceneObject = new CubicVR.SceneObject({
mesh: null, // A [[Mesh]].
name: null, // Name of SceneObject for referencing/retrieval.
motion: null, // A [[Motion]] for this SceneObject.
position: [0.0, 0.0, 0.0], // Position in [[Scene]] or relative to parent.
rotation: [0.0, 0.0, 0.0], // Rotation in [[Scene]] or relative to parent.
scale: [1.0,1.0,1.0], // Scale in [[Scene]] or relative to parent.
wireframe: false // If mesh has edges render as wireframe if true.
});
Bind another SceneObject as a child of this object. The child object's transformation becomes relative to the parent.
Parameters:
childSceneObject - Another SceneObject to bind as a child.
Returns:
none
If the mesh was created with buildWireframe:true
or mesh.buildEdges()
was called before compilation this will tell the SceneObject to render it as wireframe. Note this can be over-ridden to true at the Mesh or Scene level.
Parameters:
-
value
:true
to render the Mesh as wireframe,false
otherwise.
Returns:
none
Returns the current state of the SceneObject's wireframe flag.
Returns:
true
if set to wireframe, false
if not.
Return an array of the current Mesh's materials as an instance. You can independently modify or replace the materials in the returned array to apply new materials to that specific instance of the Mesh.
Returns:
Return a specific material instanced by name. This will allow you to acquire and modify a specific material for the Mesh in the SceneObject that only applies to this specific instance.
Parameters:
-
name
: A string name representing the "name" property of the Material. Alternately you can use the numeric index of the material.
Returns:
A new instance of the Mesh's material referenced by name
to be used for the SceneObject instance.
Retrieve the SceneObject's current axis-aligned bounding box information. The AABB is just a bounding box that contains the SceneObject's mesh's transformed bounding box in world space.
Returns:
Axis-aligned bounding box, format: [ [minX, minY, minZ] , [maxX, maxY, maxZ] ]
.