SceneObject
A networkable object that exists in the 3D world.
GameObject
GameObjectAssetPtr
The asset Id used for the game object this entity is based on.
bool
If this entity is a GameObject, it flags if this instance delinates from the template.
Transform
Editing
bool
Controls client-side rendering of the object.
bool
Determines if the object may be selected from wihin the Tools.
Mounting
Public Static Attributes
bool
Disables rendering of all instances of this type.
bool
Disables selection of all instances of this type.
Public Functions
bool
attachChild(string _subObject)
attach an object to this one, preserving its present transform.
bool
attachChildAt(SceneObject _subObject, MatrixF _offset, int _node)
Mount object to this one with the specified offset expressed in our coordinate space.
bool
attachToParent(string _sceneObject)
attachToParent(SceneObject)specify a null or non-null parent
bool
detachChild(string _subObject)
SceneObject subObject.
int
getChild(int _index)
getChild(S32 index) – returns child SceneObject at given index
Point3F
Get Euler rotation of this object.
VectorF
Get the direction this object is facing.
TransformF
Get the object's inverse transform.
int
getMountedObject(int slot)
Get the object mounted at a particular slot.
int
Get the number of objects mounted to us.
int
getMountedObjectNode(int slot)
Get the mount node index of the object mounted at our given slot.
int
getMountNodeObject(int node)
Get the object mounted at our given node index.
int
returns number of direct child objects
int
returns number of recursively-nested child objects
Box3F
Get the object's bounding box (relative to the object's origin).
int
Get the object we are mounted to.
int
returns ID of parent SceneObject
Point3F
Get the object's world position.
VectorF
Get the right vector of the object.
Point3F
getScale()
Get the object's scale.
float
getSpeed()
Returns the velocity of a scene-object.
TransformF
Get the object's transform.
int
getType()
Return the type mask for this object.
VectorF
Get the up vector of the object.
Box3F
Get the object's world bounding box.
Point3F
Get the center of the object's world bounding box.
bool
Check if this object has a global bounds set.
bool
Check if we are mounted to another object.
bool
mountObject(SceneObject objB, int slot, TransformF txfm)
Mount objB to this object at the desired slot with optional transform.
void
setForwardVector(VectorF newForward, VectorF upVector)
Sets the forward vector of a scene object, making it face Y+ along the new vector.
void
setPosition(Point3F pos)
Set the object's world position.
void
setScale(Point3F scale)
Set the object's scale.
void
setTransform(TransformF txfm)
Set the object's transform (orientation and position).
void
unmount()
Unmount us from the currently mounted object if any.
bool
unmountObject(SceneObject target)
Unmount an object from ourselves.
Detailed Description
A networkable object that exists in the 3D world.
The SceneObject class provides the foundation for 3D objects in the Engine. It exposes the functionality for:
Position, rotation and scale within the world.
Working with a scene graph (in the Zone and Portal sections), allowing efficient and robust rendering of the game scene.
Various helper functions, including functions to get bounding information and momentum/velocity.
Mounting one SceneObject to another.
An interface for collision detection, as well as ray casting.
Lighting. SceneObjects can register lights both at lightmap generation time, and dynamic lights at runtime (for special effects, such as from flame or a projectile, or from an explosion).
You do not typically work with SceneObjects themselves. The SceneObject provides a reference within the game world (the scene), but does not render to the client on its own. The same is true of collision detection beyond that of the bounding box. Instead you use one of the many classes that derrive from SceneObject, such as TSStatic.
Difference Between setHidden() and isRenderEnabled
When it comes time to decide if a SceneObject should render or not, there are two methods that can stop the SceneObject from rendering at all. You need to be aware of the differences between these two methods as they impact how the SceneObject is networked from the server to the client.
The first method of manually controlling if a SceneObject is rendered is through its SceneObject::isRenderEnabled property. When set to false the SceneObject is considered invisible but still present within the scene. This means it still takes part in collisions and continues to be networked.
The second method is using the setHidden() method. This will actually remove a SceneObject from the scene and it will no longer be networked from the server to the cleint. Any client-side ghost of the object will be deleted as the server no longer considers the object to be in scope.
GameObject
GameObjectAssetPtr GameObject
The asset Id used for the game object this entity is based on.
bool dirtyGameObject
If this entity is a GameObject, it flags if this instance delinates from the template.
Transform
MatrixPosition position
Object world position.
MatrixRotation rotation
Object world orientation.
Point3F scale
Object world scale.
Editing
bool isRenderEnabled
Controls client-side rendering of the object.
bool isSelectionEnabled
Determines if the object may be selected from wihin the Tools.
Mounting
pid mountPID
PersistentID of object we are mounted to.
Unlike the SimObjectID that is determined at run time, the PersistentID of an object is saved with the level/mission and may be used to form a link between objects.
int mountNode
Node we are mounted to.
MatrixPosition mountPos
Position we are mounted at ( object space of our mount object ).
MatrixRotation mountRot
Rotation we are mounted at ( object space of our mount object ).
Public Static Attributes
bool isRenderable
Disables rendering of all instances of this type.
bool isSelectable
Disables selection of all instances of this type.
Public Functions
attachChild(string _subObject)
attach an object to this one, preserving its present transform.
attachChildAt(SceneObject _subObject, MatrixF _offset, int _node)
Mount object to this one with the specified offset expressed in our coordinate space.
attachToParent(string _sceneObject)
attachToParent(SceneObject)specify a null or non-null parent
detachChild(string _subObject)
SceneObject subObject.
getChild(int _index)
getChild(S32 index) – returns child SceneObject at given index
getEulerRotation()
Get Euler rotation of this object.
the orientation of the object in the form of rotations around the X, Y and Z axes in degrees.
getForwardVector()
Get the direction this object is facing.
a vector indicating the direction this object is facing.
note:This is the object's y axis.
getInverseTransform()
Get the object's inverse transform.
the inverse transform of the object
getMountedObject(int slot)
Get the object mounted at a particular slot.
Parameters:
slot | mount slot index to query |
ID of the object mounted in the slot, or 0 if no object.
getMountedObjectCount()
Get the number of objects mounted to us.
the number of mounted objects.
getMountedObjectNode(int slot)
Get the mount node index of the object mounted at our given slot.
Parameters:
slot | mount slot index to query |
index of the mount node used by the object mounted in this slot.
getMountNodeObject(int node)
Get the object mounted at our given node index.
Parameters:
node | mount node index to query |
ID of the first object mounted at the node, or 0 if none found.
getNumChildren()
returns number of direct child objects
getNumProgeny()
returns number of recursively-nested child objects
getObjectBox()
Get the object's bounding box (relative to the object's origin).
six fields, two Point3Fs, containing the min and max points of the objectbox.
getObjectMount()
Get the object we are mounted to.
the SimObjectID of the object we're mounted to, or 0 if not mounted.
getParent()
returns ID of parent SceneObject
getPosition()
Get the object's world position.
the current world position of the object
getRightVector()
Get the right vector of the object.
a vector indicating the right direction of this object.
note:This is the object's x axis.
getScale()
Get the object's scale.
object scale as a Point3F
getSpeed()
Returns the velocity of a scene-object.
getTransform()
Get the object's transform.
the current transform of the object
getType()
Return the type mask for this object.
The numeric type mask for the object.
getUpVector()
Get the up vector of the object.
a vector indicating the up direction of this object.
note:This is the object's z axis.
getWorldBox()
Get the object's world bounding box.
six fields, two Point3Fs, containing the min and max points of the worldbox.
getWorldBoxCenter()
Get the center of the object's world bounding box.
the center of the world bounding box for this object.
isGlobalBounds()
Check if this object has a global bounds set.
If global bounds are set to be true, then the object is assumed to have an infinitely large bounding box for collision and rendering purposes.
true if the object has a global bounds.
isMounted()
Check if we are mounted to another object.
true if mounted to another object, false if not mounted.
mountObject(SceneObject objB, int slot, TransformF txfm)
Mount objB to this object at the desired slot with optional transform.
Parameters:
objB | Object to mount onto us |
slot | Mount slot ID |
txfm | (optional) mount offset transform |
true if successful, false if failed (objB is not valid)
setForwardVector(VectorF newForward, VectorF upVector)
Sets the forward vector of a scene object, making it face Y+ along the new vector.
Parameters:
The | new forward vector to set. |
(Optional) | The up vector to use to help orient the rotation. |
setPosition(Point3F pos)
Set the object's world position.
Parameters:
pos | the new world position of the object |
setScale(Point3F scale)
Set the object's scale.
Parameters:
scale | object scale to set |
setTransform(TransformF txfm)
Set the object's transform (orientation and position).
Parameters:
txfm | object transform to set |
unmount()
Unmount us from the currently mounted object if any.
unmountObject(SceneObject target)
Unmount an object from ourselves.
Parameters:
target | object to unmount |
true if successful, false if failed