SceneObject

A networkable object that exists in the 3D world.

Inherit:
NetObject

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:

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.

Methods

Point3F SceneObject::getEulerRotation()

Get Euler rotation of this object.

Returns:the orientation of the object in the form of rotations around the X, Y and Z axes in degrees.
VectorF SceneObject::getForwardVector()

Get the direction this object is facing.

Returns:a vector indicating the direction this object is facing.
TransformF SceneObject::getInverseTransform()

Get the object’s inverse transform.

Returns:the inverse transform of the object
int SceneObject::getMountedObject(int slot)

Get the object mounted at a particular slot.

Parameters:slot – mount slot index to query
Returns:ID of the object mounted in the slot, or 0 if no object.
int SceneObject::getMountedObjectCount()

Get the number of objects mounted to us.

Returns:the number of mounted objects.
int SceneObject::getMountedObjectNode(int slot)

Get the mount node index of the object mounted at our given slot.

Parameters:slot – mount slot index to query
Returns:index of the mount node used by the object mounted in this slot.
int SceneObject::getMountNodeObject(int node)

Get the object mounted at our given node index.

Parameters:node – mount node index to query
Returns:ID of the first object mounted at the node, or 0 if none found.
Box3F SceneObject::getObjectBox()

Get the object’s bounding box (relative to the object’s origin).

Returns:six fields, two Point3Fs, containing the min and max points of the objectbox.
int SceneObject::getObjectMount()

Get the object we are mounted to.

Returns:the SimObjectID of the object we’re mounted to, or 0 if not mounted.
Point3F SceneObject::getPosition()

Get the object’s world position. Reimplemented in Camera .

Returns:the current world position of the object
VectorF SceneObject::getRightVector()

Get the right vector of the object.

Returns:a vector indicating the right direction of this object.
Point3F SceneObject::getScale()

Get the object’s scale.

Returns:object scale as a Point3F
TransformF SceneObject::getTransform()

Get the object’s transform.

Returns:the current transform of the object
int SceneObject::getType()

Return the type mask for this object.

Returns:The numeric type mask for the object.
VectorF SceneObject::getUpVector()

Get the up vector of the object.

Returns:a vector indicating the up direction of this object.
Box3F SceneObject::getWorldBox()

Get the object’s world bounding box.

Returns:six fields, two Point3Fs, containing the min and max points of the worldbox.
Point3F SceneObject::getWorldBoxCenter()

Get the center of the object’s world bounding box.

Returns:the center of the world bounding box for this object.
bool SceneObject::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.

Returns:true if the object has a global bounds.
bool SceneObject::isMounted()

Check if we are mounted to another object.

Returns:true if mounted to another object, false if not mounted.
bool SceneObject::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
Returns:

true if successful, false if failed (objB is not valid)

void SceneObject::setScale(Point3F scale)

Set the object’s scale.

Parameters:scale – object scale to set
void SceneObject::setTransform(TransformF txfm)

Set the object’s transform (orientation and position).

Parameters:txfm – object transform to set
void SceneObject::unmount()

Unmount us from the currently mounted object if any.

bool SceneObject::unmountObject(SceneObject target)

Unmount an object from ourselves.

Parameters:target – object to unmount
Returns:true if successful, false if failed

Fields

bool SceneObject::isRenderEnabled

Controls client-side rendering of the object.

bool SceneObject::isSelectionEnabled

Determines if the object may be selected from wihin the Tools.

int SceneObject::mountNode

Node we are mounted to.

pid SceneObject::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.

MatrixPosition SceneObject::mountPos

Position we are mounted at ( object space of our mount object ).

MatrixRotation SceneObject::mountRot

Rotation we are mounted at ( object space of our mount object ).

MatrixPosition SceneObject::position

Object world position.

MatrixRotation SceneObject::rotation

Object world orientation.

Point3F SceneObject::scale

Object world scale.