SceneObject
Engine/source/scene/sceneObject.h
A 3D object.
Classes:
TGE uses the term "mount" in a quirky, staticky way relating to its limited use to have riders and guns mounted on a vehicle (and similar) I did not alter that code at all (yet) and did not want to keep its terminology for other reasons I decided to support a hierarchy of scene objects and dubbed the operations attaching and removing child SceneObjects.
Mounted object.
Iterator over the zones that the object is assigned to.
Bidirectional link between a zone manager and its objects.
Zoning
Refresh the zoning state of this object, if it isn't up-to-date anymore.
ZoneRef *
Return the first link in the zone list of this object.
bool
If an object moves, its zoning state needs to be updated.
Number of zones this object is assigned to.
ZoneRef *
List of zones that this object is part of.
struct
Mounting
mountObject(SceneObject * obj, S32 node, const MatrixF & xfm)
ex: Mount B to A at A's node N A.mountObject( B, N )
unmountObject(SceneObject * obj)
Remove an object mounting.
onMount(SceneObject * obj, S32 node)
Callback when this object is mounted.
onUnmount(SceneObject * obj, S32 node)
Callback when this object is unmounted.
Return the object that this object is mounted to.
Return object link of next object mounted to this object's mount.
Returns object list of objects mounted to this object.
Returns the mount id that this is mounted to.
bool
Returns true if this object is mounted to anything at all Also try to resolve the PID to objectId here if it is pending.
Returns the number of object mounted along with this.
getMountedObject(S32 idx)
Returns the object mounted at a position in the mount list.
getMountedObjectNode(S32 idx)
Returns the node the object at idx is mounted to.
getMountNodeObject(S32 node)
Returns the object a object on the mount list is mounted to.
Transform and Collision Members
Regenerates the world-space bounding box and bounding sphere.
Regenerates the render-world-space bounding box and sphere.
Regenerates the object-space bounding box from the world-space bounding box, the world space to object space transform, and the object scale.
Called when the size of the object changes.
Transform from object space to world space.
Transform from world space to object space (inverse).
Bounding sphere in world space.
Render matrix to transform object space to world space.
Render matrix to transform world space to object space.
Render bounding box in world space.
Render bounding sphere in world space.
bool
Whether this object is considered to have an infinite bounding box.
SceneContainer Interface
When objects are searched, we go through all the zones and ask them for all of their objects.
Because an object can exist in multiple zones, the container sequence key is set to the id of the current search. Then, while searching, we check to see if an object's sequence key is the same as the current search key. If it is, it will NOT be added to the list of returns since it has already been processed.
Returns the container sequence key.
setContainerSeqKey(const U32 key)
Sets the container sequence key.
Container database that the object is assigned to.
SceneContainer sequence key.
SceneManager Functionality
Return the SceneManager that this SceneObject belongs to.
Adds object to the client or server container depending on the object.
Removes the object from the client/server container.
Returns a pointer to the container that contains this object.
Flags
bool
Return true if this object is rendered.
setRenderEnabled(bool value)
Set whether the object gets rendered.
bool
Return true if this object can be selected in the editor.
setSelectionEnabled(bool value)
Set whether the object can be selected in the editor.
bool
Return true if the object doesn't want to be subjected to culling when in the editor.
bool
Return true if the object should be taken into account for visual occlusion.
Collision and transform related interface
The Render Transform is the interpolated transform with respect to the frame rate.
The Render Transform will differ from the object transform because the simulation is updated in fixed intervals, which controls the object transform. The framerate is, most likely, higher than this rate, so that is why the render transform is interpolated and will differ slightly from the object transform.
Disables collisions for this object including raycasts.
Enables collisions for this object.
bool
Returns true if collisions are enabled.
onCollision(SceneObject * object, const VectorF & vec)
This gets called when an object collides with this object.
bool
Returns true if this object allows itself to be displaced.
Returns the momentum of this object.
setMomentum(const Point3F & momentum)
Sets the momentum of this object.
bool
displaceObject(const Point3F & displaceVector)
Displaces this object by a vector.
Returns the transform which can be used to convert object space to world space.
Returns the transform which can be used to convert world space into object space.
Returns the bounding box for this object in world coordinates.
Returns the bounding sphere for this object in world coordinates.
Returns the center of the bounding box in world coordinates.
setTransform(const MatrixF & mat)
Sets the Object -> World transform.
setForwardVector(VectorF newForward, VectorF upVector)
Sets the forward vector of the object.
setRenderTransform(const MatrixF & mat)
This sets the render transform for this object.
Returns the render transform.
Returns the render transform to convert world to local coordinates.
Returns the render world box.
buildConvex(const Box3F & box, Convex * convex)
Builds a convex hull for this object.
bool
buildPolyList(PolyListContext context, AbstractPolyList * polyList, const Box3F & box, const SphereF & sphere)
Builds a list of polygons which intersect a bounding volume.
bool
buildExportPolyList(ColladaUtils::ExportData * exportData, const Box3F & box, const SphereF & sphere)
Builds a list of polygons which intersect a bounding volume for exporting.
bool
bool
buildSilhouette(const SceneCameraState & cameraState, Vector< Point3F > & outPoints)
Build a world-space silhouette polygon for the object for the given camera settings.
bool
containsPoint(const Point3F & point)
Return true if the given point is contained by the object's (collision) shape.
Returns the position of the object.
Returns the render-position of the object.
setPosition(const Point3F & pos)
Sets the position of the object.
Gets the velocity of the object.
setVelocity(const Point3F & v)
Sets the velocity of the object.
applyImpulse(const Point3F & pos, const VectorF & vec)
Applies an impulse force to this object.
applyRadialImpulse(const Point3F & origin, F32 radius, F32 magnitude)
Applies a radial impulse to the object using the impulse origin and force.
distanceTo(const Point3F & pnt)
Returns the distance from this object to a point
Sound
bool
Return whether the object's collision shape is blocking sound.
Return the ambient sound space active inside the volume of this object or NULL if the object does not have its own ambient space.
Rendering
prepRenderImage(SceneRenderState * state)
Called when the SceneManager is ready for the registration of render instances.
Lighting
setLightingPlugin(SceneObjectLightingPlugin * plugin)
Gets the number of zones containing this object.
getCurrZone(const U32 index)
Returns the nth zone containing this object.
Global Bounds
const bool
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.
Protected field getters/setters
const char *
_getRenderEnabled(void * object, const char * data)
bool
_setRenderEnabled(void * object, const char * index, const char * data)
const char *
_getSelectionEnabled(void * object, const char * data)
bool
_setSelectionEnabled(void * object, const char * index, const char * data)
bool
_setFieldPosition(void * object, const char * index, const char * data)
bool
_setFieldRotation(void * object, const char * index, const char * data)
bool
_setFieldScale(void * object, const char * index, const char * data)
bool
_setMountPID(void * object, const char * index, const char * data)
bool
_setAccuEnabled(void * object, const char * index, const char * data)
Public Types
_Anonymous_ { MaxObjectZones = 128 NumMountPoints = 32 NumMountPointBits = 5 }
_Anonymous_ { SELECTED = BIT(0) PRE_SELECTED = BIT(1) }
SceneObjectFlags { RenderEnabledFlag = BIT( 0 ) SelectionEnabledFlag = BIT( 1 ) DisableCullingInEditorFlag = BIT( 2 ) VisualOccluderFlag = BIT( 3 ) SoundOccluderFlag = BIT( 4 ) NextFreeFlag = BIT( 5 ) }
Bit-flags stored in mObjectFlags.
SceneObjectMasks { InitialUpdateMask = BIT( 0 ) ScaleMask = BIT( 1 ) FlagMask = BIT( 2 ) MountedMask = BIT( 3 ) NextFreeMask = BIT( 4 ) }
Networking dirty mask.
Parent
Public Friends
class
class
class
class
class
Protected Attributes
Object which must be ticked before this object.
struct SceneObject::AttachInfo
SceneObjectLightingPlugin attached to this object.
Combination of SceneObjectFlags.
SceneManager to which this SceneObject belongs.
Links installed by SceneTrackers attached to this object.
Public Attributes
Public Static Attributes
Signal< void(SceneObject *) >
Triggered when a SceneObject onAdd is called.
Signal< void(SceneObject *) >
Triggered when a SceneObject onRemove is called.
Private Attributes
bool
For ScopeAlways objects to be able to properly implement setHidden(), they need to temporarily give up ScopeAlways status while being hidden.
Protected Functions
Returns the greatest object flag bit defined.
bool
Called when this is added to a SceneManager.
Called when this is removed from its current SceneManager.
Public Functions
bool
attachChild(SceneObject * subObject)
attach a subobject, but do not alter the subObject's present absolute position or orientation
bool
attachChildAt(SceneObject * subObject, MatrixF atThisTransform, S32 node)
attach a subobject, at the specified offset expressed in our local coordinate space
bool
attachChildAt(SceneObject * subObject, Point3F atThisPosition)
attach a subobject, at the specified position expressed in our local coordinate space
bool
attachToParent(SceneObject * parent, MatrixF * atThisOffset, S32 node)
this is useful for setting NULL parent (making SceneObject a root object)
Clears the effects of a call to processAfter()
Returns the object that this processes after.
returns the (direct) child SceneObject at the given index (0 <= index <= getNumChildren() - 1)
how many child SceneObjects are (directly) attached to this one?
how many child objects does this SceneObject have when we count them recursively?
Return the ProcessList for this object to use.
Return the type mask that indicates to which broad object categories this object belongs.
getUtilizedAssets(Vector< StringTableEntry > * usedAssetsList)
Called after any property of the object is changed in the world editor.
bool
isCamera()
bool
isChildOf(SceneObject * )
is this SceneObject a child (directly or indirectly) of the given object?
set position in parent SceneObject's coordinate space (or in world space if no parent)
moveRender(const Point3F & delta)
bool
bool
onAdd()
Called when the object is added to the sim.
onCameraScopeQuery(NetConnection * cr, CameraScopeQuery * camInfo)
Queries the object about information used to determine scope.
onDeleteNotify(SimObject * object)
Called when a SimObject is deleted.
onLostChild(SceneObject * subObject)
notification that a direct child object has been detached
onLostParent(SceneObject * oldParent)
returns the transform relative to parent SceneObject transform (or world transform if no parent)
onNewChild(SceneObject * subObject)
notification that a direct child object has been attached
onNewParent(SceneObject * newParent)
Called to let instance specific code happen.
packUpdate(NetConnection * conn, U32 mask, BitStream * stream)
Instructs this object to pack its state for transfer over the network.
processAfter(ProcessObject * obj)
Force this object to process after some other object.
setProcessTick(bool t)
Set the status of tick processing.
setSelectionFlags(U8 flags)
unpackUpdate(NetConnection * conn, BitStream * stream)
Instructs this object to read state data previously packed with packUpdate.
UpdateXformChange(const MatrixF & mat)
bool
writeField(StringTableEntry fieldname, const char * value)
Determine whether or not a field should be written.
Public Static Functions
bool
_setGameObject(void * object, const char * index, const char * data)
Private Functions
Detailed Description
A 3D object.
Introduction
SceneObject exists as a foundation for 3D objects in Torque. It provides the basic functionality for:
A scene graph (in the Zones and Portals sections), allowing efficient and robust rendering of the game scene.
Various helper functions, including functions to get bounding information and momentum/velocity.
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).
Manipulating scene objects, for instance varying scale.
An Example
Melv May has written a most marvelous example object deriving from SceneObject. Unfortunately this page is too small to contain it.
Zoning
_updateZoningState()
Refresh the zoning state of this object, if it isn't up-to-date anymore.
_getZoneRefHead()
Return the first link in the zone list of this object.
Each link represents a single zone that the object is assigned to.
note:This method will return the zoning list as is. In case the zoning state of the object is dirty, the list contents may be outdated.
bool mZoneRefDirty
If an object moves, its zoning state needs to be updated.
This is deferred to when the state is actually needed and this flag indicates a refresh is necessary.
U32 mNumCurrZones
Number of zones this object is assigned to.
note:If mZoneRefDirty is set, this might be outdated.
ZoneRef * mZoneRefHead
List of zones that this object is part of.
note:If mZoneRefDirty is set, this might be outdated.
Mounting
mountObject(SceneObject * obj, S32 node, const MatrixF & xfm)
ex: Mount B to A at A's node N A.mountObject( B, N )
Parameters:
obj | Object to mount |
node | Mount node ID |
Reimplemented by: TurretShape, Vehicle, VPath
unmountObject(SceneObject * obj)
Remove an object mounting.
Parameters:
obj | Object to unmount |
Reimplemented by: TurretShape, VPath
unmount()
Unmount this object from it's mount.
Reimplemented by: Player
onMount(SceneObject * obj, S32 node)
Callback when this object is mounted.
Parameters:
obj | Object we are mounting to. |
node | Node we are unmounting from. |
Reimplemented by: GameBase, PhysicsForce, ShapeBase, TSStatic, VActor
onUnmount(SceneObject * obj, S32 node)
Callback when this object is unmounted.
This should be overridden to set maskbits or do other object type specific work. Parameters:
obj | Object we are unmounting from. |
node | Node we are unmounting from. |
Reimplemented by: GameBase, PhysicsForce, Player, ShapeBase, StaticShape, Trigger, TSStatic, TurretShape, VActor
getMountTransform(S32 index, const MatrixF & xfm, MatrixF * outMat)
Reimplemented by: ShapeBase, VPath
getRenderMountTransform(F32 delta, S32 index, const MatrixF & xfm, MatrixF * outMat)
Reimplemented by: ShapeBase, VPath
getObjectMount()
Return the object that this object is mounted to.
getMountLink()
Return object link of next object mounted to this object's mount.
getMountList()
Returns object list of objects mounted to this object.
getMountNode()
Returns the mount id that this is mounted to.
isMounted()
Returns true if this object is mounted to anything at all Also try to resolve the PID to objectId here if it is pending.
getMountedObjectCount()
Returns the number of object mounted along with this.
getMountedObject(S32 idx)
Returns the object mounted at a position in the mount list.
Parameters:
idx | Position on the mount list |
getMountedObjectNode(S32 idx)
Returns the node the object at idx is mounted to.
Parameters:
idx | Index |
getMountNodeObject(S32 node)
Returns the object a object on the mount list is mounted to.
Parameters:
node |
resolveMountPID()
MountInfo mMount
SimPersistID * mMountPID
StringTableEntry mGameObjectAssetId
AssetPtr< GameObjectAsset > mGameObjectAsset
bool mDirtyGameObject
Transform and Collision Members
resetWorldBox()
Regenerates the world-space bounding box and bounding sphere.
resetRenderWorldBox()
Regenerates the render-world-space bounding box and sphere.
resetObjectBox()
Regenerates the object-space bounding box from the world-space bounding box, the world space to object space transform, and the object scale.
onScaleChanged()
Called when the size of the object changes.
Reimplemented by: ConvexShape, Player, TSStatic
MatrixF mLastXform
MatrixF mObjToWorld
Transform from object space to world space.
MatrixF mWorldToObj
Transform from world space to object space (inverse).
Point3F mObjScale
Object scale.
Box3F mObjBox
Bounding box in object space.
Box3F mWorldBox
Bounding box (AABB) in world space.
SphereF mWorldSphere
Bounding sphere in world space.
MatrixF mRenderObjToWorld
Render matrix to transform object space to world space.
MatrixF mRenderWorldToObj
Render matrix to transform world space to object space.
Box3F mRenderWorldBox
Render bounding box in world space.
SphereF mRenderWorldSphere
Render bounding sphere in world space.
bool mGlobalBounds
Whether this object is considered to have an infinite bounding box.
S32 mCollisionCount
SceneContainer Interface
When objects are searched, we go through all the zones and ask them for all of their objects.
Because an object can exist in multiple zones, the container sequence key is set to the id of the current search. Then, while searching, we check to see if an object's sequence key is the same as the current search key. If it is, it will NOT be added to the list of returns since it has already been processed.
getContainerSeqKey()
Returns the container sequence key.
setContainerSeqKey(const U32 key)
Sets the container sequence key.
SceneContainer * mContainer
Container database that the object is assigned to.
U32 mContainerSeqKey
SceneContainer sequence key.
SceneObjectRef * mBinRefHead
U32 mBinMinX
U32 mBinMaxX
U32 mBinMinY
U32 mBinMaxY
SceneManager Functionality
getSceneManager()
Return the SceneManager that this SceneObject belongs to.
addToScene()
Adds object to the client or server container depending on the object.
removeFromScene()
Removes the object from the client/server container.
getContainer()
Returns a pointer to the container that contains this object.
Flags
isRenderEnabled()
Return true if this object is rendered.
setRenderEnabled(bool value)
Set whether the object gets rendered.
isSelectionEnabled()
Return true if this object can be selected in the editor.
setSelectionEnabled(bool value)
Set whether the object can be selected in the editor.
isCullingDisabledInEditor()
Return true if the object doesn't want to be subjected to culling when in the editor.
isVisualOccluder()
Return true if the object should be taken into account for visual occlusion.
Collision and transform related interface
The Render Transform is the interpolated transform with respect to the frame rate.
The Render Transform will differ from the object transform because the simulation is updated in fixed intervals, which controls the object transform. The framerate is, most likely, higher than this rate, so that is why the render transform is interpolated and will differ slightly from the object transform.
disableCollision()
Disables collisions for this object including raycasts.
Reimplemented by: RigidShape
enableCollision()
Enables collisions for this object.
Reimplemented by: RigidShape
isCollisionEnabled()
Returns true if collisions are enabled.
onCollision(SceneObject * object, const VectorF & vec)
This gets called when an object collides with this object.
Parameters:
object | Object colliding with this object |
vec | Vector along which collision occurred |
Reimplemented by: ShapeBase
isDisplacable()
Returns true if this object allows itself to be displaced.
Reimplemented by: Player
getMomentum()
Returns the momentum of this object.
Reimplemented by: Player
setMomentum(const Point3F & momentum)
Sets the momentum of this object.
Parameters:
momentum | Momentum |
Reimplemented by: Player
getMass()
Returns the mass of this object.
Reimplemented by: PhysicsShape, ShapeBase
displaceObject(const Point3F & displaceVector)
Displaces this object by a vector.
Parameters:
displaceVector | Displacement vector |
Reimplemented by: Player
getTransform()
Returns the transform which can be used to convert object space to world space.
Reimplemented by: ReflectionProbe
getWorldTransform()
Returns the transform which can be used to convert world space into object space.
getScale()
Returns the scale of the object.
Reimplemented by: ReflectionProbe, T3DSceneComponent
getObjBox()
Returns the bounding box for this object in local coordinates.
getWorldBox()
Returns the bounding box for this object in world coordinates.
getWorldSphere()
Returns the bounding sphere for this object in world coordinates.
getBoxCenter()
Returns the center of the bounding box in world coordinates.
setTransform(const MatrixF & mat)
Sets the Object -> World transform.
Parameters:
mat | New transform matrix |
Reimplemented by: afxMooring, afxCamera, DecalRoad, MeshRoad, River, WaterBlock, WaterPlane, Forest, ForestWindEmitter, CoverPoint, NavMesh, OpenVRTrackedObject, SceneSpace, ScenePolyhedralZone, SceneSimpleZone, AccumulationVolume, Camera, ConvexShape, RenderMeshExample, RenderObjectExample, RenderShapeExample, fxShapeReplicatedStatic, Precipitation, GroundPlane, Item, LightBase, ReflectionProbe, MissionMarker, NotesObject, OcclusionVolume, PhysicalZone, PhysicsShape, Player, Portal, Prefab, ProximityMine, RigidShape, T3DSceneComponent, SFXEmitter, ShapeBase, StaticShape, Trigger, TSStatic, AITurretShape, TurretShape, TerrainBlock, VActor, VPath
setScale(const VectorF & scale)
Sets the scale for the object.
Parameters:
scale | Scaling values |
Reimplemented by: WaterBlock, GroundPlane, T3DSceneComponent, VPath, DecalRoad, MeshRoad, River, NavMesh, ReflectionProbe, PhysicsShape, PointLight, Prefab, SFXEmitter, SpotLight, TerrainBlock
setForwardVector(VectorF newForward, VectorF upVector)
Sets the forward vector of the object.
setRenderTransform(const MatrixF & mat)
This sets the render transform for this object.
Parameters:
mat | New render transform |
Reimplemented by: Camera
getRenderTransform()
Returns the render transform.
getRenderWorldTransform()
Returns the render transform to convert world to local coordinates.
getRenderWorldBox()
Returns the render world box.
setHidden(bool hidden)
Reimplemented from: SimObject
Reimplemented by: WayPoint, ShapeBase
buildConvex(const Box3F & box, Convex * convex)
Builds a convex hull for this object.
Think of a convex hull as a low-res mesh which covers, as tightly as possible, the object mesh, and is used as a collision mesh. Parameters:
box | |
convex | Convex mesh generated (out) |
Reimplemented by: MeshRoad, Forest, OpenVRTrackedObject, ConvexShape, GroundPlane, Item, PhysicalZone, Player, ShapeBase, Trigger, TSStatic, VehicleBlocker, TerrainBlock
buildPolyList(PolyListContext context, AbstractPolyList * polyList, const Box3F & box, const SphereF & sphere)
Builds a list of polygons which intersect a bounding volume.
This will use either the sphere or the box, not both, the SceneObject implementation ignores sphere.
context | A contentual hint as to the type of polylist to build. |
polyList | Poly list build (out) |
box | Box bounding volume |
sphere | Sphere bounding volume |
Reimplemented by: MeshRoad, River, WaterBlock, WaterPlane, Forest, ConvexShape, GroundPlane, Item, Player, Prefab, ShapeBase, TSStatic, WheeledVehicle, TerrainBlock
buildExportPolyList(ColladaUtils::ExportData * exportData, const Box3F & box, const SphereF & sphere)
Builds a list of polygons which intersect a bounding volume for exporting.
This will use either the sphere or the box, not both, the SceneObject implementation ignores sphere.
context | A contentual hint as to the type of polylist to build. |
polyList | Poly list build (out) |
box | Box bounding volume |
sphere | Sphere bounding volume |
Reimplemented by: ConvexShape, Prefab, TSStatic
castRay(const Point3F & start, const Point3F & end, RayInfo * info)
Casts a ray and obtain collision information, returns true if RayInfo is modified.
Parameters:
start | Start point of ray |
end | End point of ray |
info | Collision information obtained (out) |
Reimplemented by: afxModel, MeshRoad, River, WaterBlock, WaterPlane, OpenVRTrackedObject, ConvexShape, GroundPlane, Player, ShapeBase, Trigger, TSStatic, TerrainBlock, Forest
castRayRendered(const Point3F & start, const Point3F & end, RayInfo * info)
Casts a ray against rendered geometry, returns true if RayInfo is modified.
Parameters:
start | Start point of ray |
end | End point of ray |
info | Collision information obtained (out) |
Reimplemented by: ShapeBase, TSStatic, Forest
buildSilhouette(const SceneCameraState & cameraState, Vector< Point3F > & outPoints)
Build a world-space silhouette polygon for the object for the given camera settings.
This is used for occlusion.
Parameters:
cameraState | Camera view parameters. |
outPoints | Vector to store the resulting polygon points in. Leave untouched if method is not implemented. |
Reimplemented by: AccumulationVolume, OcclusionVolume
containsPoint(const Point3F & point)
Return true if the given point is contained by the object's (collision) shape.
The default implementation will return true if the point is within the object's bounding box. Subclasses should implement more precise tests.
Reimplemented by: WaterObject, ScenePolyhedralObject, ScenePolyhedralObject, SFXEmitter
collideBox(const Point3F & start, const Point3F & end, RayInfo * info)
Reimplemented by: VPath, MeshRoad, River, ConvexShape, TerrainBlock, Forest
getPosition()
Returns the position of the object.
Reimplemented by: T3DSceneComponent
getRenderPosition()
Returns the render-position of the object.
setPosition(const Point3F & pos)
Sets the position of the object.
getVelocity()
Gets the velocity of the object.
Reimplemented by: Camera, Item, PhysicsShape, Player, Projectile, RigidShape
setVelocity(const Point3F & v)
Sets the velocity of the object.
Parameters:
v | Velocity |
Reimplemented by: Debris, Camera, Item, Player, ShapeBase
applyImpulse(const Point3F & pos, const VectorF & vec)
Applies an impulse force to this object.
Parameters:
pos | Position where impulse came from in world space |
vec | Velocity vector (Impulse force F = m * v) |
Reimplemented by: Item, PhysicsDebris, PhysicsShape, Player, ShapeBase, RigidShape
applyRadialImpulse(const Point3F & origin, F32 radius, F32 magnitude)
Applies a radial impulse to the object using the impulse origin and force.
Parameters:
origin | Point of origin of the radial impulse. |
radius | The radius of the impulse area. |
magnitude | The strength of the impulse. |
Reimplemented by: Forest, PhysicsDebris, PhysicsShape
distanceTo(const Point3F & pnt)
Returns the distance from this object to a point
Parameters:
pnt | World space point to measure to |
Reimplemented by: WaterPlane, WaterBlock
Sound
isOccludingSound()
Return whether the object's collision shape is blocking sound.
getSoundAmbience()
Return the ambient sound space active inside the volume of this object or NULL if the object does not have its own ambient space.
Reimplemented by: WaterObject, SceneAmbientSoundObject, SceneAmbientSoundObject
Rendering
prepRenderImage(SceneRenderState * state)
Called when the SceneManager is ready for the registration of render instances.
Parameters:
state | Rendering state. |
Reimplemented by: afxMagicMissile, afxBillboard, afxModel, afxMooring, afxStaticShape, afxZodiacPlane, afxParticlePool, MeshRoad, BasicClouds, CloudLayer, DecalRoad, ScatterSky, SkyBox, Sun, VolumetricFog, WaterObject, WaterPlane, Forest, ForestWindEmitter, CoverPoint, NavMesh, NavPath, OpenVRTrackedObject, SceneSpace, Marker, SceneSimpleZone, ConvexShape, Debris, DecalManager, RenderMeshExample, RenderObjectExample, RenderShapeExample, Explosion, fxFoliageReplicator, fxShapeReplicator, GroundCover, Lightning, ParticleEmitter, Precipitation, Ribbon, GroundPlane, Item, LightBase, ReflectionProbe, Skylight, SphereEnvironmentProbe, NotesObject, PhysicalZone, PhysicsDebris, PhysicsShape, Player, Projectile, ProximityMine, SFXEmitter, ShapeBase, Trigger, TSStatic, TurretShape, TerrainBlock
Lighting
setLightingPlugin(SceneObjectLightingPlugin * plugin)
getLightingPlugin()
getNumCurrZones()
Gets the number of zones containing this object.
getCurrZone(const U32 index)
Returns the nth zone containing this object.
Global Bounds
isGlobalBounds()
setGlobalBounds()
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.
They can't be toggled currently.
Protected field getters/setters
_getRenderEnabled(void * object, const char * data)
_setRenderEnabled(void * object, const char * index, const char * data)
_getSelectionEnabled(void * object, const char * data)
_setSelectionEnabled(void * object, const char * index, const char * data)
_setFieldPosition(void * object, const char * index, const char * data)
_setFieldRotation(void * object, const char * index, const char * data)
_setFieldScale(void * object, const char * index, const char * data)
_setMountPID(void * object, const char * index, const char * data)
_setAccuEnabled(void * object, const char * index, const char * data)
Public Types
@156
Enumerator
- MaxObjectZones = 128
Maximum number of zones that an object can concurrently be assigned to.
- NumMountPoints = 32
- NumMountPointBits = 5
@157
Enumerator
- SELECTED = BIT(0)
- PRE_SELECTED = BIT(1)
SceneObjectFlags
Enumerator
- RenderEnabledFlag = BIT( 0 )
If set, the object can be rendered.
note:
The per-class render disable flag can override the per-object flag.
- SelectionEnabledFlag = BIT( 1 )
If set, the object can be selected in the editor.
note:
The per-class selection disable flag can override the per-object flag.
- DisableCullingInEditorFlag = BIT( 2 )
If set, object will not be subjected to culling when in the editor.
This is useful to bypass zone culling and always render certain editor-only visual elements (like the zones themselves).
- VisualOccluderFlag = BIT( 3 )
If set, object will be used as a visual occluder.
In this case, the object should implement buildSilhouette() and return a convex silhouette polygon.
- SoundOccluderFlag = BIT( 4 )
If set, object will be used as a sound occluder.
- NextFreeFlag = BIT( 5 )
Bit-flags stored in mObjectFlags.
If a derived class adds more flags they must overload getObjectFlagMax to ensure those flags will be transmitted over the network.
SceneObjectMasks
Enumerator
- InitialUpdateMask = BIT( 0 )
- ScaleMask = BIT( 1 )
- FlagMask = BIT( 2 )
- MountedMask = BIT( 3 )
- NextFreeMask = BIT( 4 )
Networking dirty mask.
typedef NetObject Parent
Public Friends
Protected Attributes
SimObjectPtr< SceneObject > mAfterObject
Object which must be ticked before this object.
struct SceneObject::AttachInfo mGraph
SceneObjectLightingPlugin * mLightPlugin
SceneObjectLightingPlugin attached to this object.
BitSet32 mObjectFlags
Combination of SceneObjectFlags.
SceneManager * mSceneManager
SceneManager to which this SceneObject belongs.
SceneObjectLink * mSceneObjectLinks
Links installed by SceneTrackers attached to this object.
U8 mSelectionFlags
U32 mTypeMask
Object type mask.
SimObjectTypes
Public Attributes
GFXTextureObject * mAccuTex
bool mPathfindingIgnore
Public Static Attributes
Signal< void(SceneObject *) > smSceneObjectAdd
Triggered when a SceneObject onAdd is called.
Signal< void(SceneObject *) > smSceneObjectRemove
Triggered when a SceneObject onRemove is called.
Private Attributes
bool mIsScopeAlways
For ScopeAlways objects to be able to properly implement setHidden(), they need to temporarily give up ScopeAlways status while being hidden.
Otherwise the client-side ghost will not disappear as the server-side object will be forced to stay in scope.
Protected Functions
getObjectFlagMax()
Returns the greatest object flag bit defined.
Only bits within this range will be transmitted over the network.
onSceneAdd()
Called when this is added to a SceneManager.
Reimplemented by: SceneRootZone, SceneSimpleZone, DecalManager
onSceneRemove()
Called when this is removed from its current SceneManager.
Reimplemented by: VolumetricFogRTManager, SceneRootZone, SceneZoneSpace, DecalManager, Portal, ShapeBase
Public Functions
SceneObject()
~SceneObject()
attachChild(SceneObject * subObject)
attach a subobject, but do not alter the subObject's present absolute position or orientation
attachChildAt(SceneObject * subObject, MatrixF atThisTransform, S32 node)
attach a subobject, at the specified offset expressed in our local coordinate space
attachChildAt(SceneObject * subObject, Point3F atThisPosition)
attach a subobject, at the specified position expressed in our local coordinate space
attachToParent(SceneObject * parent, MatrixF * atThisOffset, S32 node)
this is useful for setting NULL parent (making SceneObject a root object)
clearProcessAfter()
Reimplemented from: ProcessObject
DECLARE_CONOBJECT(SceneObject )
getAfterObject()
Reimplemented from: ProcessObject
getChild(U32 index)
returns the (direct) child SceneObject at the given index (0 <= index <= getNumChildren() - 1)
getNumChildren()
how many child SceneObjects are (directly) attached to this one?
getNumProgeny()
how many child objects does this SceneObject have when we count them recursively?
returns a count of children plus their children, recursively
getParent()
getProcessList()
Return the ProcessList for this object to use.
getSelectionFlags()
getTypeMask()
Return the type mask that indicates to which broad object categories this object belongs.
getUtilizedAssets(Vector< StringTableEntry > * usedAssetsList)
Reimplemented by: GroundPlane, Prefab, TSStatic, TerrainBlock
inspectPostApply()
Reimplemented from: SimObject
Reimplemented by: BasicClouds, CloudLayer, DecalRoad, MeshRoad, River, ScatterSky, SkyBox, Sun, TimeOfDay, VolumetricFog, WaterBlock, WaterObject, WaterPlane, Forest, ForestWindEmitter, CoverPoint, NavMesh, NavPath, OpenVRTrackedObject, Marker, AccumulationVolume, ConvexShape, RenderMeshExample, RenderShapeExample, fxFoliageReplicator, fxShapeReplicator, GroundCover, ParticleEmitterNode, Precipitation, RibbonNode, GameBase, GroundPlane, LightBase, BoxEnvironmentProbe, ReflectionProbe, Skylight, SphereEnvironmentProbe, MissionMarker, WayPoint, SpawnSphere, CameraBookmark, NotesObject, PhysicalZone, PhysicsShape, Prefab, SFXEmitter, Trigger, TSStatic, TerrainBlock
isCamera()
Reimplemented by: afxCamera, Camera
isChildOf(SceneObject * )
is this SceneObject a child (directly or indirectly) of the given object?
move(const Point3F & delta)
set position in parent SceneObject's coordinate space (or in world space if no parent)
move the object in parent SceneObject's coordinate space (or in world space if no parent) as localMove(const Point3F &delta), with different signature move the object in world space, without altering place in scene hierarchy
move(F32 x, F32 y, F32 z)
as move(const Point3F &delta), with different signature
moveRender(const Point3F & delta)
needsSelectionHighlighting()
onAdd()
Reimplemented from: SimObject
Reimplemented by: afxCamera, afxChoreographer, afxEffectron, afxMagicMissile, afxMagicSpell, afxSelectron, afxSpellBook, afxBillboard, afxModel, afxMooring, afxParticleEmitter, afxParticleEmitterPath, afxProjectile, afxZodiacPlane, afxParticlePool, BasicClouds, CloudLayer, DecalRoad, MeshRoad, River, ScatterSky, SkyBox, Sun, TimeOfDay, VolumetricFog, WaterBlock, WaterObject, WaterPlane, Forest, ForestWindEmitter, CoverPoint, NavMesh, NavPath, OpenVRTrackedObject, ScenePolyhedralObject, ScenePolyhedralObject, SceneSpace, SimPath::Path, Marker, ScenePolyhedralZone, SceneRootZone, AccumulationVolume, AIPlayer, Camera, ConvexShape, Debris, RenderMeshExample, RenderObjectExample, RenderShapeExample, Explosion, fxFoliageReplicator, fxShapeReplicator, GroundCover, Lightning, ParticleEmitter, ParticleEmitterNode, Precipitation, Ribbon, RibbonNode, Splash, GameBase, GroundPlane, Item, LightBase, BoxEnvironmentProbe, ReflectionProbe, Skylight, SphereEnvironmentProbe, MissionMarker, WayPoint, SpawnSphere, CameraBookmark, NotesObject, OcclusionVolume, PathCamera, PathShape, PhysicalZone, PhysicsDebris, PhysicsForce, PhysicsShape, Player, Prefab, Projectile, ProximityMine, RigidShape, SFXEmitter, ShapeBase, StaticShape, Trigger, TSStatic, AITurretShape, TurretShape, FlyingVehicle, HoverVehicle, Vehicle, VehicleBlocker, WheeledVehicle, TerrainBlock, VActor, VPath
onCameraScopeQuery(NetConnection * cr, CameraScopeQuery * camInfo)
Reimplemented from: NetObject
Reimplemented by: afxCamera, Player, ShapeBase
onDeleteNotify(SimObject * object)
Reimplemented from: SimSet
Reimplemented by: afxChoreographer, afxMagicMissile, afxMagicSpell, Item, ShapeBase, Trigger, afxCamera, afxResidueMgr, Camera, ForestWindEmitter, NavPath, VPath
onLostChild(SceneObject * subObject)
notification that a direct child object has been detached
onLostParent(SceneObject * oldParent)
returns the transform relative to parent SceneObject transform (or world transform if no parent)
returns the position within parent SceneObject space (or world space if no parent) Sets the Object -> Parent transform. If no parent SceneObject, this is equivalent to setTransform()
Parameters:
mat | New transform matrix Called to let instance specific code happen |
onNewChild(SceneObject * subObject)
notification that a direct child object has been attached
onNewParent(SceneObject * newParent)
Called to let instance specific code happen.
onRemove()
Reimplemented from: SimGroup
Reimplemented by: afxCamera, afxChoreographer, afxMagicMissile, afxMagicSpell, afxSelectron, afxSpellBook, afxBillboard, afxModel, afxMooring, afxParticleEmitter, afxParticleEmitterPath, afxProjectile, afxZodiacPlane, afxParticlePool, BasicClouds, CloudLayer, DecalRoad, MeshRoad, River, ScatterSky, SkyBox, Sun, TimeOfDay, VolumetricFog, VolumetricFogRTManager, WaterBlock, WaterObject, WaterPlane, Forest, ForestWindEmitter, CoverPoint, NavMesh, NavPath, OpenVRTrackedObject, SceneSpace, SimPath::Path, Marker, SceneRootZone, AccumulationVolume, AIPlayer, Camera, ConvexShape, Debris, RenderMeshExample, RenderObjectExample, RenderShapeExample, Explosion, fxFoliageReplicator, fxShapeReplicator, GroundCover, Lightning, ParticleEmitter, ParticleEmitterNode, Precipitation, Ribbon, RibbonNode, Splash, GameBase, GroundPlane, Item, LightBase, BoxEnvironmentProbe, ReflectionProbe, Skylight, SphereEnvironmentProbe, MissionMarker, CameraBookmark, NotesObject, PathCamera, PathShape, PhysicalZone, PhysicsDebris, PhysicsForce, PhysicsShape, Player, Prefab, Projectile, ProximityMine, RigidShape, SFXEmitter, ShapeBase, StaticShape, Trigger, TSStatic, AITurretShape, TurretShape, FlyingVehicle, HoverVehicle, Vehicle, VehicleBlocker, WheeledVehicle, TerrainBlock, VActor, VPath
packUpdate(NetConnection * conn, U32 mask, BitStream * stream)
Reimplemented from: NetObject
Reimplemented by: AccumulationVolume, GroundCover, Precipitation, PathCamera, PathShape, afxChoreographer, afxEffectron, afxMagicSpell, afxSelectron, afxSpellBook, afxMooring, afxProjectile, afxStaticShape, DecalRoad, MeshRoad, River, afxCamera, afxMagicMissile, BasicClouds, CloudLayer, ScatterSky, SkyBox, Sun, TimeOfDay, VolumetricFog, WaterBlock, WaterObject, WaterPlane, Forest, ForestWindEmitter, CoverPoint, NavMesh, NavPath, OpenVRTrackedObject, Marker, SceneSimpleZone, Camera, ConvexShape, RenderMeshExample, RenderObjectExample, RenderShapeExample, fxFoliageReplicator, fxShapeReplicator, Lightning, ParticleEmitterNode, RibbonNode, Splash, GameBase, Item, LightBase, BoxEnvironmentProbe, ReflectionProbe, Skylight, SphereEnvironmentProbe, MissionMarker, WayPoint, SpawnSphere, CameraBookmark, NotesObject, PhysicalZone, PhysicsShape, Player, PointLight, Portal, Prefab, Projectile, ProximityMine, RigidShape, SFXEmitter, ShapeBase, SpotLight, StaticShape, Trigger, TSStatic, AITurretShape, TurretShape, FlyingVehicle, HoverVehicle, Vehicle, VehicleBlocker, WheeledVehicle, TerrainBlock, SceneAmbientSoundObject, SceneAmbientSoundObject, ScenePolyhedralObject, ScenePolyhedralObject, SceneSpace, SceneZoneSpace, GroundPlane, VHumanoidActor, VActor, VPath
PerformUpdatesForChildren(MatrixF mat)
processAfter(ProcessObject * obj)
Reimplemented from: ProcessObject
setProcessTick(bool t)
Reimplemented from: ProcessObject
setSelectionFlags(U8 flags)
Reimplemented by: ShapeBase, TSStatic
unpackUpdate(NetConnection * conn, BitStream * stream)
Reimplemented from: NetObject
Reimplemented by: afxChoreographer, afxEffectron, afxMagicSpell, afxSelectron, afxSpellBook, afxMooring, afxProjectile, afxStaticShape, DecalRoad, MeshRoad, River, AccumulationVolume, GroundCover, Precipitation, PathCamera, PathShape, afxCamera, afxMagicMissile, BasicClouds, CloudLayer, ScatterSky, SkyBox, Sun, TimeOfDay, VolumetricFog, WaterBlock, WaterObject, WaterPlane, Forest, ForestWindEmitter, CoverPoint, NavMesh, NavPath, OpenVRTrackedObject, Marker, SceneSimpleZone, Camera, ConvexShape, RenderMeshExample, RenderObjectExample, RenderShapeExample, fxFoliageReplicator, fxShapeReplicator, Lightning, ParticleEmitterNode, RibbonNode, Splash, GameBase, Item, LightBase, BoxEnvironmentProbe, ReflectionProbe, Skylight, SphereEnvironmentProbe, MissionMarker, WayPoint, SpawnSphere, CameraBookmark, NotesObject, PhysicalZone, PhysicsShape, Player, PointLight, Portal, Prefab, Projectile, ProximityMine, RigidShape, SFXEmitter, ShapeBase, SpotLight, StaticShape, Trigger, TSStatic, AITurretShape, TurretShape, FlyingVehicle, HoverVehicle, Vehicle, VehicleBlocker, WheeledVehicle, TerrainBlock, SceneAmbientSoundObject, SceneAmbientSoundObject, ScenePolyhedralObject, ScenePolyhedralObject, SceneSpace, SceneZoneSpace, GroundPlane, VHumanoidActor, VActor, VPath
updateChildTransform()
updateRenderChangesByParent()
UpdateXformChange(const MatrixF & mat)
writeField(StringTableEntry fieldname, const char * value)
Reimplemented from: SimObject
Reimplemented by: DecalRoad, MeshRoad, River, SceneZoneSpace, ConvexShape, ReflectionProbe, Portal, ScenePolyhedralObject, ScenePolyhedralObject
Public Static Functions
_setGameObject(void * object, const char * index, const char * data)
initPersistFields()