Untold Engine  Beta v0.0.16
docs
U4DEngine::U4DDynamicAction Class Reference

The U4DDynamicAction class represents a actions such as kinetics and collisions applied to a 3D model entity. More...

Inherits U4DEngine::U4DStaticAction.

Public Member Functions

 U4DDynamicAction (U4DModel *uU4DModel)
 Constructor for the class.
 
 ~U4DDynamicAction ()
 Destructor for the class.
 
 U4DDynamicAction (const U4DDynamicAction &value)
 Copy constructor.
 
U4DDynamicActionoperator= (const U4DDynamicAction &value)
 Copy constructor.
 
void addForce (U4DVector3n &uForce)
 Method which adds all the forces acting on the model. More...
 
void addMoment (U4DVector3n &uMoment)
 Method which adds all the moments acting on the model. More...
 
void enableKineticsBehavior ()
 Method which enables kinetics behavior on the 3D model. More...
 
void pauseKineticsBehavior ()
 Method which pauses kinetics behavior on the 3D model.
 
void resumeKineticsBehavior ()
 Method which resumes kinetics behavior on the 3D model.
 
bool isKineticsBehaviorEnabled ()
 Method which returns if kinetics behavior are allowed to act on the 3D model. More...
 
void clearForce ()
 Clears all forces acting on the 3D model.
 
void clearMoment ()
 Clears all moments acting on the 3D model.
 
void setVelocity (U4DVector3n &uVelocity)
 Method which sets the velocity of the model. More...
 
void setAngularVelocity (U4DVector3n &uAngularVelocity)
 Method which sets the angular velocity of the model. More...
 
void setTimeOfImpact (float uTimeOfImpact)
 Method which sets the time of impact. i.e., the time the 3D model will collide with another 3D model. More...
 
void setAxisOfRotation (U4DVector3n &uAxisOfRotation)
 Method which sets the axis of rotation for the 3D model. More...
 
void setAwake (bool uValue)
 Method which sets if the 3D model is awake. More...
 
void setEquilibrium (bool uValue)
 Method which sets if the 3D model is in equilibrium. More...
 
void setGravity (U4DVector3n &uGravity)
 Method which sets the gravity force acting on the 3D model. More...
 
void setDragCoefficient (U4DVector2n &uDragCoefficient)
 Method which sets the drag coefficient acting on the 3D model. More...
 
void computeModelKineticEnergy (float dt)
 Method which determines the kinetic motion of the model. More...
 
void resetTimeOfImpact ()
 Method which reset the time of impact of the model.
 
void resetGravity ()
 Method which resets the gravivy force of the model to its default value. Default gravity is (0.0,-10.0,0.0)
 
void resetDragCoefficient ()
 Method which resets the drag coefficients to its default value. Default drag coefficient is (0.9,0.9)
 
U4DVector3n getForce ()
 Method which returns commulative forces acting on the model. More...
 
U4DVector3n getMoment ()
 Method which returns commulative moments acting on the model. More...
 
U4DVector3n getVelocity ()
 Method which returns the velocity of the model. More...
 
U4DVector3n getAngularVelocity ()
 Method which returns the angular velocity of the model. More...
 
bool getAwake ()
 Method which returns if the 3D model is awake. More...
 
float getModelKineticEnergy ()
 Method which returns the kinetic energy of the model. More...
 
float getTimeOfImpact ()
 Method which returns the collision time of impact of the model. More...
 
U4DVector3n getAxisOfRotation ()
 Method which returns the model axis of rotation. More...
 
bool getEquilibrium ()
 Method which returns if the model is in equilibrium. More...
 
U4DVector3n getGravity ()
 Method which returns the gravity force acting on the 3D model. More...
 
U4DVector2n getDragCoefficient ()
 Method which returns the drag coefficients acting on the 3D model. More...
 
void loadIntoCollisionEngine (U4DEntityManager *uEntityManager)
 Self load 3D model into the collision engine. More...
 
void loadIntoPhysicsEngine (U4DEntityManager *uEntityManager, float dt)
 Self load 3D model into the physics engine. More...
 
void cleanUp ()
 clear collision information, resets time of impact, resets equilibrium, clears collision list
 
- Public Member Functions inherited from U4DEngine::U4DStaticAction
 U4DStaticAction (U4DModel *uU4DModel)
 Constructor for the class.
 
 ~U4DStaticAction ()
 Destructor for the class.
 
 U4DStaticAction (const U4DStaticAction &value)
 Copy constructor.
 
U4DStaticActionoperator= (const U4DStaticAction &value)
 Copy constructor. More...
 
void initMass (float uMass)
 Method which sets the mass of the model. More...
 
void initCenterOfMass (U4DVector3n &uCenterOfMass)
 Method which sets the center of mass of the model. More...
 
void initCoefficientOfRestitution (float uValue)
 Method which sets the coefficient of restitution of the model. More...
 
void initInertiaTensorType (INERTIATENSORTYPE uInertiaTensorType)
 Method which sets the Interta tensor type of the model. More...
 
void initAsPlatform (bool uValue)
 Method which sets the model as a platform. More...
 
void setNarrowPhaseBoundingVolumeVisibility (bool uValue)
 Methods which sets the visibility of the Narrow-Phase bounding volume. More...
 
void setBroadPhaseBoundingVolumeVisibility (bool uValue)
 Methods which sets the visibility of the Broad-Phase bounding volume. More...
 
void setCollisionNormalFaceDirection (U4DVector3n &uNormalFaceDirection)
 Method which sets the collision normal face direction. More...
 
void setCollisionPenetrationDepth (float uPenetrationDepth)
 Method which sets the collision penetration depth. More...
 
void setNormalForce (U4DVector3n &uNormalForce)
 Method which sets the Normal force. More...
 
void setModelHasCollided (bool uValue)
 Method which informs the engine that the model has collided. More...
 
void setModelHasCollidedBroadPhase (bool uValue)
 Method which informs the engine that the model has collided in broad phase stage. More...
 
void enableCollisionBehavior ()
 Enables the model to detect collisions. More...
 
void pauseCollisionBehavior ()
 Pauses the ability of the model to detect collisions.
 
void resumeCollisionBehavior ()
 Resumes the ability for the model to detect collisions. More...
 
bool isCollisionBehaviorEnabled ()
 Method which returns if the model can detect collisions. More...
 
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. More...
 
void clearConvexHullVertices ()
 Method which clears all convex-hull vertices.
 
void clearCollisionInformation ()
 Method which clears all collision information.
 
float getMass () const
 Method which returns the mass of the model. More...
 
U4DVector3n getCenterOfMass ()
 Method which returns the center of mass of the model. More...
 
float getCoefficientOfRestitution ()
 Method which returns the coefficient of restitution of the model. More...
 
INERTIATENSORTYPE getInertiaTensorType ()
 Method which returns the inertia tensor type of the model. More...
 
bool getIsPlatform ()
 Method which returns if the model should be seens as a platform by the collision detection system. More...
 
U4DMatrix3n getMomentOfInertiaTensor ()
 Method which returns a 3x3 matrix representing the moment of inertia tensor. More...
 
U4DMatrix3n getInverseMomentOfInertiaTensor ()
 Method which returns a 3x3 matrix representing the inverse moment of inertia tensor. More...
 
std::vector< U4DVector3n > & getConvexHullVertices ()
 Method which returns the convex-hull vertices. More...
 
int getConvexHullVerticesCount ()
 Method which returns the convex-hull vertices count. More...
 
U4DBoundingVolumegetNarrowPhaseBoundingVolume ()
 Method which returns the narrow-phase bounding volume. More...
 
bool getNarrowPhaseBoundingVolumeVisibility ()
 Method which returns if the engine should render the narrow-phase bounding volume. More...
 
U4DBoundingVolumegetBroadPhaseBoundingVolume ()
 Method which returns the broad-phase bounding volume. More...
 
bool getBroadPhaseBoundingVolumeVisibility ()
 Method which returns if the engine should render the broad-phase bounding volume. More...
 
U4DVector3n getNormalForce ()
 Method which returns a 3D vector representing the Normal force. More...
 
std::vector< U4DVector3ngetCollisionContactPoints ()
 Method which returns the collision contact points. More...
 
void clearCollisionContactPoints ()
 Method which clears all collision contact points.
 
U4DVector3n getCollisionNormalFaceDirection ()
 Method which returns the collision normal face direction vector. More...
 
float getCollisionPenetrationDepth ()
 Method which returns the collision penetration depth. More...
 
bool getModelHasCollided ()
 Method which returns true if the model has collided. More...
 
bool getModelHasCollidedBroadPhase ()
 Method which returns true if the model has collided in Broad Phase stage. More...
 
void setCollisionFilterCategory (int uFilterCategory)
 Sets the filter category for collision. More...
 
void setCollisionFilterMask (int uFilterMask)
 Set the filter mask for collision. More...
 
void setCollisionFilterGroupIndex (signed int uGroupIndex)
 Sets the group filter for collisions. More...
 
int getCollisionFilterCategory ()
 Get the collision filter category for the entity. More...
 
int getCollisionFilterMask ()
 Get the collision filter mask for the entity
More...
 
signed int getCollisionFilterGroupIndex ()
 Get the filter group index
More...
 
void setIsCollisionSensor (bool uValue)
 Sets the entity as a collision sensor. More...
 
bool getIsCollisionSensor ()
 Is the entity a collision sensor. More...
 
void addToCollisionList (U4DStaticAction *uModel)
 Add all the 3D models the entity is currently colliding. More...
 
void addToBroadPhaseCollisionList (U4DStaticAction *uModel)
 Add all the 3D models the entity is currently colliding in broad phase collision. More...
 
std::vector< U4DStaticAction * > getCollisionList ()
 Gets a list of all entities currently colliding with the entity. More...
 
std::vector< U4DStaticAction * > getBroadPhaseCollisionList ()
 Gets a list of all entities currently colliding (broad phase stage) with the entity. More...
 
void setCollidingTag (std::string uCollidingTag)
 Sets a collision tag. More...
 
std::string getCollidingTag ()
 Gets the collision tag. More...
 
void clearCollisionList ()
 Clears the collision list. More...
 
void clearBroadPhaseCollisionList ()
 Clears the collision list. More...
 

Protected Attributes

U4DVector3n velocity
 Velocity of 3D model.
 
U4DVector3n acceleration
 Acceleration of 3D model.
 
U4DVector3n force
 Force of 3D model.
 
U4DVector3n angularVelocity
 Angular velocity of 3D model.
 
U4DVector3n moment
 Moment of 3D model.
 
U4DVector3n axisOfRotation
 The axis of rotation of the 3D model.
 
U4DVector3n gravity
 Gravity force of the 3D model.
 
U4DVector2n dragCoefficient
 Drag force coefficient of the 3D model.
 
float modelKineticEnergy
 Kinetic energy of the model.
 
float timeOfImpact
 Time that the 3D model will impact with another object.
 
bool equilibrium
 Equilibrium state of the model upon collision.
 
bool kineticsEnabled
 Variable representing if kinetics behaviour enabled. i.e., if forces can act upon the 3D model.
 
bool isAwake
 Variable representing if the model is awake.
 
- Protected Attributes inherited from U4DEngine::U4DStaticAction
std::string name
 Name of the entity.
 

Additional Inherited Members

- Public Attributes inherited from U4DEngine::U4DStaticAction
U4DModelmodel
 

Detailed Description

The U4DDynamicAction class represents a actions such as kinetics and collisions applied to a 3D model entity.

Member Function Documentation

◆ addForce()

void U4DEngine::U4DDynamicAction::addForce ( U4DVector3n uForce)

Method which adds all the forces acting on the model.

Parameters
uForce3D vector representing a force

◆ addMoment()

void U4DEngine::U4DDynamicAction::addMoment ( U4DVector3n uMoment)

Method which adds all the moments acting on the model.

Parameters
uMoment3D vector representing a moment

◆ computeModelKineticEnergy()

void U4DEngine::U4DDynamicAction::computeModelKineticEnergy ( float  dt)

Method which determines the kinetic motion of the model.

Parameters
dttime step value

◆ enableKineticsBehavior()

void U4DEngine::U4DDynamicAction::enableKineticsBehavior ( )

Method which enables kinetics behavior on the 3D model.

It allows forces to act on the 3D model

◆ getAngularVelocity()

U4DVector3n U4DEngine::U4DDynamicAction::getAngularVelocity ( )

Method which returns the angular velocity of the model.

Returns
Returns the angular velocity of the model

◆ getAwake()

bool U4DEngine::U4DDynamicAction::getAwake ( )

Method which returns if the 3D model is awake.

Returns
returns true if the 3D model is awake

◆ getAxisOfRotation()

U4DVector3n U4DEngine::U4DDynamicAction::getAxisOfRotation ( )

Method which returns the model axis of rotation.

Returns
Returns 3D vector representing the model axis of rotation

◆ getDragCoefficient()

U4DVector2n U4DEngine::U4DDynamicAction::getDragCoefficient ( )

Method which returns the drag coefficients acting on the 3D model.

Returns
Returns a 2D vector representing the drag coefficients acting on the model

◆ getEquilibrium()

bool U4DEngine::U4DDynamicAction::getEquilibrium ( )

Method which returns if the model is in equilibrium.

Returns
Returns true if the model is in equilibrium

◆ getForce()

U4DVector3n U4DEngine::U4DDynamicAction::getForce ( )

Method which returns commulative forces acting on the model.

Returns
Returns commulative forces acting on the model

◆ getGravity()

U4DVector3n U4DEngine::U4DDynamicAction::getGravity ( )

Method which returns the gravity force acting on the 3D model.

Returns
Returns a 3D vector representing the gravity force acting on the model

◆ getModelKineticEnergy()

float U4DEngine::U4DDynamicAction::getModelKineticEnergy ( )

Method which returns the kinetic energy of the model.

Returns
Returns the kinetic energy of the model

◆ getMoment()

U4DVector3n U4DEngine::U4DDynamicAction::getMoment ( )

Method which returns commulative moments acting on the model.

Returns
Returns commulative moments acting on the model

◆ getTimeOfImpact()

float U4DEngine::U4DDynamicAction::getTimeOfImpact ( )

Method which returns the collision time of impact of the model.

Returns
Returns the time of impact

◆ getVelocity()

U4DVector3n U4DEngine::U4DDynamicAction::getVelocity ( )

Method which returns the velocity of the model.

Returns
Returns the velocity of the model

◆ isKineticsBehaviorEnabled()

bool U4DEngine::U4DDynamicAction::isKineticsBehaviorEnabled ( )

Method which returns if kinetics behavior are allowed to act on the 3D model.

Returns
Returns true if kinetics behavior are allowed to act on the 3D model

◆ loadIntoCollisionEngine()

void U4DEngine::U4DDynamicAction::loadIntoCollisionEngine ( U4DEntityManager uEntityManager)

Self load 3D model into the collision engine.

Parameters
uEntityManagerpointer to the entity manager

◆ loadIntoPhysicsEngine()

void U4DEngine::U4DDynamicAction::loadIntoPhysicsEngine ( U4DEntityManager uEntityManager,
float  dt 
)

Self load 3D model into the physics engine.

Parameters
uEntityManagerpointer to the entity manager
dttime step

◆ setAngularVelocity()

void U4DEngine::U4DDynamicAction::setAngularVelocity ( U4DVector3n uAngularVelocity)

Method which sets the angular velocity of the model.

Parameters
uAngularVelocity3D vector representing the angular velocity of the model

◆ setAwake()

void U4DEngine::U4DDynamicAction::setAwake ( bool  uValue)

Method which sets if the 3D model is awake.

Parameters
uValueSet to true if the 3D model is awake

◆ setAxisOfRotation()

void U4DEngine::U4DDynamicAction::setAxisOfRotation ( U4DVector3n uAxisOfRotation)

Method which sets the axis of rotation for the 3D model.

Parameters
uAxisOfRotation3D vector representing the axis of rotation for the model

◆ setDragCoefficient()

void U4DEngine::U4DDynamicAction::setDragCoefficient ( U4DVector2n uDragCoefficient)

Method which sets the drag coefficient acting on the 3D model.

Parameters
uDragCoefficient2D vector representing the drag coefficients

◆ setEquilibrium()

void U4DEngine::U4DDynamicAction::setEquilibrium ( bool  uValue)

Method which sets if the 3D model is in equilibrium.

Parameters
uValueSet to true if the 3D model is in equilibrium

◆ setGravity()

void U4DEngine::U4DDynamicAction::setGravity ( U4DVector3n uGravity)

Method which sets the gravity force acting on the 3D model.

Parameters
uGravity3D vector representing the gravity force acting on the 3D model

◆ setTimeOfImpact()

void U4DEngine::U4DDynamicAction::setTimeOfImpact ( float  uTimeOfImpact)

Method which sets the time of impact. i.e., the time the 3D model will collide with another 3D model.

Parameters
uTimeOfImpactThe time of impact

◆ setVelocity()

void U4DEngine::U4DDynamicAction::setVelocity ( U4DVector3n uVelocity)

Method which sets the velocity of the model.

Parameters
uVelocity3D vector representing the velocity of the model