U4DEngine::U4DStaticModel class

The U4DStaticModel class represents a 3D static model entity.

Base classes

class U4DModel
The U4DModel class represents a 3D model entity.

Derived classes

class U4DDynamicModel
The U4DDynamicModel class represents a 3D dynamic model entity.

Constructors, destructors, conversion operators

U4DStaticModel()
Constructor for the class.
~U4DStaticModel()
Destructor for the class.
U4DStaticModel(const U4DStaticModel& value)
Copy constructor.

Public functions

auto operator=(const U4DStaticModel& value) -> U4DStaticModel&
Copy constructor.
void initMass(float uMass)
Method which sets the mass of the model.
void initCenterOfMass(U4DVector3n& uCenterOfMass)
Method which sets the center of mass of the model.
void initCoefficientOfRestitution(float uValue)
Method which sets the coefficient of restitution of the model.
void initInertiaTensorType(INERTIATENSORTYPE uInertiaTensorType)
Method which sets the Interta tensor type of the model.
void initAsPlatform(bool uValue)
Method which sets the model as a platform.
void setNarrowPhaseBoundingVolumeVisibility(bool uValue)
Methods which sets the visibility of the Narrow-Phase bounding volume.
void setBroadPhaseBoundingVolumeVisibility(bool uValue)
Methods which sets the visibility of the Broad-Phase bounding volume.
void setCollisionNormalFaceDirection(U4DVector3n& uNormalFaceDirection)
Method which sets the collision normal face direction.
void setCollisionPenetrationDepth(float uPenetrationDepth)
Method which sets the collision penetration depth.
void setNormalForce(U4DVector3n& uNormalForce)
Method which sets the Normal force.
void setModelHasCollided(bool uValue)
Method which informs the engine that the model has collided.
void setModelHasCollidedBroadPhase(bool uValue)
Method which informs the engine that the model has collided in broad phase stage.
void enableCollisionBehavior()
Enables the model to detect collisions.
void pauseCollisionBehavior()
Pauses the ability of the model to detect collisions.
void resumeCollisionBehavior()
Resumes the ability for the model to detect collisions.
auto isCollisionBehaviorEnabled() -> bool virtual
Method which returns if the model can detect collisions.
void computeInertiaTensor()
Computes the inertia tensor of the model geometry.
void updateConvexHullVertices()
Method which updates the convex-hull vertices of the model.
void addCollisionContactPoint(U4DVector3n& uContactPoint)
Method which adds collision contact points to a container.
void clearConvexHullVertices()
Method which clears all convex-hull vertices.
void clearCollisionInformation()
Method which clears all collision information.
auto getMass() const -> float
Method which returns the mass of the model.
auto getCenterOfMass() -> U4DVector3n
Method which returns the center of mass of the model.
auto getCoefficientOfRestitution() -> float
Method which returns the coefficient of restitution of the model.
auto getInertiaTensorType() -> INERTIATENSORTYPE
Method which returns the inertia tensor type of the model.
auto getIsPlatform() -> bool
Method which returns if the model should be seens as a platform by the collision detection system.
auto getMomentOfInertiaTensor() -> U4DMatrix3n
Method which returns a 3x3 matrix representing the moment of inertia tensor.
auto getInverseMomentOfInertiaTensor() -> U4DMatrix3n
Method which returns a 3x3 matrix representing the inverse moment of inertia tensor.
auto getConvexHullVertices() -> std::vector<U4DVector3n>&
Method which returns the convex-hull vertices.
auto getConvexHullVerticesCount() -> int
Method which returns the convex-hull vertices count.
auto getNarrowPhaseBoundingVolume() -> U4DBoundingVolume*
Method which returns the narrow-phase bounding volume.
auto getNarrowPhaseBoundingVolumeVisibility() -> bool
Method which returns if the engine should render the narrow-phase bounding volume.
auto getBroadPhaseBoundingVolume() -> U4DBoundingVolume*
Method which returns the broad-phase bounding volume.
auto getBroadPhaseBoundingVolumeVisibility() -> bool
Method which returns if the engine should render the broad-phase bounding volume.
auto getNormalForce() -> U4DVector3n
Method which returns a 3D vector representing the Normal force.
auto getCollisionContactPoints() -> std::vector<U4DVector3n>
Method which returns the collision contact points.
void clearCollisionContactPoints()
Method which clears all collision contact points.
auto getCollisionNormalFaceDirection() -> U4DVector3n
Method which returns the collision normal face direction vector.
auto getCollisionPenetrationDepth() -> float
Method which returns the collision penetration depth.
auto getModelHasCollided() -> bool
Method which returns true if the model has collided.
auto getModelHasCollidedBroadPhase() -> bool
Method which returns true if the model has collided in Broad Phase stage.
void setCollisionFilterCategory(int uFilterCategory)
Sets the filter category for collision.
void setCollisionFilterMask(int uFilterMask)
Set the filter mask for collision.
void setCollisionFilterGroupIndex(signed int uGroupIndex)
Sets the group filter for collisions.
auto getCollisionFilterCategory() -> int
Get the collision filter category for the entity.
auto getCollisionFilterMask() -> int
Get the collision filter mask for the entity
auto getCollisionFilterGroupIndex() -> signed int
Get the filter group index
auto getModelDimensions() -> U4DVector3n
Get the 3D dimensions.
void setIsCollisionSensor(bool uValue)
Sets the entity as a collision sensor.
auto getIsCollisionSensor() -> bool
Is the entity a collision sensor.
void addToCollisionList(U4DStaticModel* uModel)
Add all the 3D models the entity is currently colliding.
void addToBroadPhaseCollisionList(U4DStaticModel* uModel)
Add all the 3D models the entity is currently colliding in broad phase collision.
auto getCollisionList() -> std::vector<U4DStaticModel*>
Gets a list of all entities currently colliding with the entity.
auto getBroadPhaseCollisionList() -> std::vector<U4DStaticModel*>
Gets a list of all entities currently colliding (broad phase stage) with the entity.
void setCollidingTag(std::string uCollidingTag)
Sets a collision tag.
auto getCollidingTag() -> std::string
Gets the collision tag.
void clearCollisionList()
Clears the collision list.
void clearBroadPhaseCollisionList()
Clears the collision list.
void enableMeshManager(int uSubDivisions)
Enables the mesh manager to build an octree.
auto getMeshOctreeManager() -> U4DMeshOctreeManager*
gets a pointer to the mesh manager in charge of building an octree

Function documentation

U4DStaticModel& U4DEngine::U4DStaticModel::operator=(const U4DStaticModel& value)

Copy constructor.

Parameters
value 3D Static model object to copy to
Returns Returns a copy of the 3D static model

void U4DEngine::U4DStaticModel::initMass(float uMass)

Method which sets the mass of the model.

Parameters
uMass Mass of the static model

void U4DEngine::U4DStaticModel::initCenterOfMass(U4DVector3n& uCenterOfMass)

Method which sets the center of mass of the model.

Parameters
uCenterOfMass Center of mass of the static model

void U4DEngine::U4DStaticModel::initCoefficientOfRestitution(float uValue)

Method which sets the coefficient of restitution of the model.

Parameters
uValue Coefficient of restitution of the static model

void U4DEngine::U4DStaticModel::initInertiaTensorType(INERTIATENSORTYPE uInertiaTensorType)

Method which sets the Interta tensor type of the model.

Parameters
uInertiaTensorType Inertia Tensor type. i.e., cubic, spherical or cylindrical

void U4DEngine::U4DStaticModel::initAsPlatform(bool uValue)

Method which sets the model as a platform.

Parameters
uValue Set to true if the collision detection system should treat this model as a floor/ground

void U4DEngine::U4DStaticModel::setNarrowPhaseBoundingVolumeVisibility(bool uValue)

Methods which sets the visibility of the Narrow-Phase bounding volume.

Parameters
uValue The engine will render the narrow-phase bounding volume if set to true

void U4DEngine::U4DStaticModel::setBroadPhaseBoundingVolumeVisibility(bool uValue)

Methods which sets the visibility of the Broad-Phase bounding volume.

Parameters
uValue The engine will render the broad-phase bounding volume if set to true

void U4DEngine::U4DStaticModel::setCollisionNormalFaceDirection(U4DVector3n& uNormalFaceDirection)

Method which sets the collision normal face direction.

Parameters
uNormalFaceDirection 3D vector representing the normal face direction

void U4DEngine::U4DStaticModel::setCollisionPenetrationDepth(float uPenetrationDepth)

Method which sets the collision penetration depth.

Parameters
uPenetrationDepth Collision penetration depth

void U4DEngine::U4DStaticModel::setNormalForce(U4DVector3n& uNormalForce)

Method which sets the Normal force.

Parameters
uNormalForce 3D vector representing the normal force

void U4DEngine::U4DStaticModel::setModelHasCollided(bool uValue)

Method which informs the engine that the model has collided.

Parameters
uValue If set to true, the model has collided

void U4DEngine::U4DStaticModel::setModelHasCollidedBroadPhase(bool uValue)

Method which informs the engine that the model has collided in broad phase stage.

Parameters
uValue If set to true, the model has collided

void U4DEngine::U4DStaticModel::enableCollisionBehavior()

Enables the model to detect collisions.

enables the model to collide with other convex objects.

void U4DEngine::U4DStaticModel::resumeCollisionBehavior()

Resumes the ability for the model to detect collisions.

informs the collision engine to re-start collision detection with this object.

bool U4DEngine::U4DStaticModel::isCollisionBehaviorEnabled() virtual

Method which returns if the model can detect collisions.

Returns Returns true if the model can detect collisions

void U4DEngine::U4DStaticModel::addCollisionContactPoint(U4DVector3n& uContactPoint)

Method which adds collision contact points to a container.

Parameters
uContactPoint collision contact points to add to container

float U4DEngine::U4DStaticModel::getMass() const

Method which returns the mass of the model.

Returns Returns the mass of the model

U4DVector3n U4DEngine::U4DStaticModel::getCenterOfMass()

Method which returns the center of mass of the model.

Returns Returns the center of mass of the model

float U4DEngine::U4DStaticModel::getCoefficientOfRestitution()

Method which returns the coefficient of restitution of the model.

Returns Returns the coefficient of restitution of the model

INERTIATENSORTYPE U4DEngine::U4DStaticModel::getInertiaTensorType()

Method which returns the inertia tensor type of the model.

Returns Returns the inertia tensor type. i.e., cubic, spherical or cylindrical

bool U4DEngine::U4DStaticModel::getIsPlatform()

Method which returns if the model should be seens as a platform by the collision detection system.

Returns Returns true if the model is a platform

U4DMatrix3n U4DEngine::U4DStaticModel::getMomentOfInertiaTensor()

Method which returns a 3x3 matrix representing the moment of inertia tensor.

Returns Returns a 3x3 matrix representing the moment of inertia tensor

U4DMatrix3n U4DEngine::U4DStaticModel::getInverseMomentOfInertiaTensor()

Method which returns a 3x3 matrix representing the inverse moment of inertia tensor.

Returns Returns a 3x3 matrix representing the inverse moment of inertia tensor

std::vector<U4DVector3n>& U4DEngine::U4DStaticModel::getConvexHullVertices()

Method which returns the convex-hull vertices.

Returns Returns the convex-hull vertices

int U4DEngine::U4DStaticModel::getConvexHullVerticesCount()

Method which returns the convex-hull vertices count.

Returns Return the convex-hull vertices count

U4DBoundingVolume* U4DEngine::U4DStaticModel::getNarrowPhaseBoundingVolume()

Method which returns the narrow-phase bounding volume.

Returns Returns the narrow-phase bounding volume

bool U4DEngine::U4DStaticModel::getNarrowPhaseBoundingVolumeVisibility()

Method which returns if the engine should render the narrow-phase bounding volume.

Returns Returns true if the engine should render the narrow-phase bounding volume

U4DBoundingVolume* U4DEngine::U4DStaticModel::getBroadPhaseBoundingVolume()

Method which returns the broad-phase bounding volume.

Returns Returns the broad-phase bounding volume

bool U4DEngine::U4DStaticModel::getBroadPhaseBoundingVolumeVisibility()

Method which returns if the engine should render the broad-phase bounding volume.

Returns Returns true if the engine should render the broad-phase bounding volume

U4DVector3n U4DEngine::U4DStaticModel::getNormalForce()

Method which returns a 3D vector representing the Normal force.

Returns Returns a 3D vector representing the normal force

std::vector<U4DVector3n> U4DEngine::U4DStaticModel::getCollisionContactPoints()

Method which returns the collision contact points.

Returns Returns the collision contact points

U4DVector3n U4DEngine::U4DStaticModel::getCollisionNormalFaceDirection()

Method which returns the collision normal face direction vector.

Returns Returns 3D vector representing the collision normal face direction vector

float U4DEngine::U4DStaticModel::getCollisionPenetrationDepth()

Method which returns the collision penetration depth.

Returns Returns the collision penetration depth

bool U4DEngine::U4DStaticModel::getModelHasCollided()

Method which returns true if the model has collided.

Returns Returns true if the model has collided

bool U4DEngine::U4DStaticModel::getModelHasCollidedBroadPhase()

Method which returns true if the model has collided in Broad Phase stage.

Returns Returns true if the model has collided

void U4DEngine::U4DStaticModel::setCollisionFilterCategory(int uFilterCategory)

Sets the filter category for collision.

Parameters
uFilterCategory filter category

The filter category refers to "I am of type...".

void U4DEngine::U4DStaticModel::setCollisionFilterMask(int uFilterMask)

Set the filter mask for collision.

Parameters
uFilterMask filter mask

The filter mask refers to "I collide with types..."

void U4DEngine::U4DStaticModel::setCollisionFilterGroupIndex(signed int uGroupIndex)

Sets the group filter for collisions.

If both group index values are the same and positive, then both entities will collide. if both group index values are the same and negative, they the entities do not collide. if either entity has a group index of zero, then the category/mask rule is used. if both entities group index are non-zero but different, the category/mask rule is used.

int U4DEngine::U4DStaticModel::getCollisionFilterCategory()

Get the collision filter category for the entity.

Returns filter category

The filter category refers to "I am of type..."

int U4DEngine::U4DStaticModel::getCollisionFilterMask()

Get the collision filter mask for the entity

Returns filter mask

the filter mask refers to "I collide with types of..."

signed int U4DEngine::U4DStaticModel::getCollisionFilterGroupIndex()

Get the filter group index

Returns filter group

If both group index values are the same and positive, then both entities will collide. if both group index values are the same and negative, they the entities do not collide. if either entity has a group index of zero, then the category/mask rule is used. if both entities group index are non-zero but different, the category/mask rule is used.

U4DVector3n U4DEngine::U4DStaticModel::getModelDimensions()

Get the 3D dimensions.

Returns vector with the dimensions

Gets the widht, length and depth dimensions of the 3D entity

void U4DEngine::U4DStaticModel::setIsCollisionSensor(bool uValue)

Sets the entity as a collision sensor.

Parameters
uValue value

When an entity is set as a sensor, the engine will not compute a collision response for the entity. That is, it will not compute the resultant velocity and position

bool U4DEngine::U4DStaticModel::getIsCollisionSensor()

Is the entity a collision sensor.

Returns true if the entity is a collision sensor

When an entity is set as a sensor, the engine will not compute a collision response for the entity. That is, it will not compute the resultant velocity and position

void U4DEngine::U4DStaticModel::addToCollisionList(U4DStaticModel* uModel)

Add all the 3D models the entity is currently colliding.

Parameters
uModel 3d model currently colliding

The collision list keeps a list of all the 3D entities currently colliding with this entity

void U4DEngine::U4DStaticModel::addToBroadPhaseCollisionList(U4DStaticModel* uModel)

Add all the 3D models the entity is currently colliding in broad phase collision.

Parameters
uModel 3d model currently colliding

The collision list keeps a list of all the 3D entities currently colliding with this entity

std::vector<U4DStaticModel*> U4DEngine::U4DStaticModel::getCollisionList()

Gets a list of all entities currently colliding with the entity.

Returns vector with a list of entities

The collision list keeps a list of all the 3D entities currently colliding with this entity

std::vector<U4DStaticModel*> U4DEngine::U4DStaticModel::getBroadPhaseCollisionList()

Gets a list of all entities currently colliding (broad phase stage) with the entity.

Returns vector with a list of entities

The collision list keeps a list of all the 3D entities currently colliding with this entity

void U4DEngine::U4DStaticModel::setCollidingTag(std::string uCollidingTag)

Sets a collision tag.

Parameters
uCollidingTag tag name

The collision tag can be used to determine exactly who is the entity colliding with

std::string U4DEngine::U4DStaticModel::getCollidingTag()

Gets the collision tag.

Returns tag name

The collision tag can be used to determine exactly who is the entity colliding with

void U4DEngine::U4DStaticModel::clearCollisionList()

Clears the collision list.

The collision list keeps a list of all the 3D entities currently colliding with this entity

void U4DEngine::U4DStaticModel::clearBroadPhaseCollisionList()

Clears the collision list.

The collision list keeps a list of all the 3D entities currently colliding with this entity during broad phase stage

void U4DEngine::U4DStaticModel::enableMeshManager(int uSubDivisions)

Enables the mesh manager to build an octree.

Parameters
uSubDivisions The subdivisions used for the octree. 1 subdivision=9 nodes, 2 subdivisions=73 node, 3 subdivisions=585 nodes

Builds an octree for the 3D model using AABB boxes