i6engine  1.0
i6e::modules::PhysicsNode Class Reference

Represents the physical state of an object simulated by the Bullet library. Contains the btTransform and a pointer to the associated rigidBody. More...

#include <D:/Projekte/i6engine/libs/i6engine-modules/include/i6engine/modules/physics/PhysicsNode.h>

Public Member Functions

 PhysicsNode (const int64_t id, const int64_t compId, const Vec3 &position, const Quaternion &rotation, const Vec3 &scale, const api::CollisionGroup &cg, const api::attributeMap &params, api::ShatterInterest shatterInterest, PhysicsManager *pm)
 constructor More...
 
 ~PhysicsNode ()
 destructor More...
 
bool addChild (const int64_t compId, const Vec3 &position, const Quaternion &rotation, const Vec3 &scale, const api::CollisionGroup &cg, const api::PhysicalStateComponent::ShapeType shapeType, const api::attributeMap &shapeParams)
 adds a new child shape to this node More...
 
void removeChild (int64_t compId)
 removes a child shape More...
 
bool empty () const
 
void reset ()
 Clears all forces and sets the velocity to 0, so that e.g. a bike after shattering doesn't still move after resetting. More...
 
void setPosition (const Vec3 &position, int64_t id)
 Override from PhysicalStateComponent to update internal transform. Sets new position by calling PhysicalStateComponent::SetPosition(const Vec3 position) and updates internal transform PhysicsNode::_transform. More...
 
void setRotation (const Quaternion &rotation, int64_t id)
 Override from PhysicalStateComponent to update internal transform. Sets new rotation by calling PhysicalStateComponent::setRotation(const Quaternion rotation) and updates internal transform PhysicsNode::_transform. More...
 
void setScale (const Vec3 &scale, int64_t id)
 Override from PhysicalStateComponent to update internal transform. Sets new scale by calling PhysicalStateComponent::setScale(Vec3 scale). More...
 
void getWorldTransform (btTransform &worldTrans) const
 Called by Bullet when the object is first scheduled for simulation to retrieve the initial transform. More...
 
void setWorldTransform (const btTransform &worldTrans)
 Called by Bullet when the simulated object has moved. More...
 
btRigidBody * getRigidBody () const
 returns the rigidBody of the PhysicsNode More...
 
api::RayTestResult HitTest (const Vec3 &from, const Vec3 &to)
 Tests a Hit with a ray given by the vector. More...
 
int64_t getID () const
 returns the GO id of the Node More...
 
int64_t getCompID () const
 
uint32_t getCrashType ()
 returns the CrashType of the Node More...
 
void setCollisionFlags (const api::CollisionGroup &cg)
 sets the collision flags of the Node More...
 
void setCrashType (uint32_t ct)
 sets the crashtype of the node More...
 
void setCrashMask (uint32_t cm)
 sets the crash mask of the Node More...
 
uint32_t getCrashMask ()
 returns the CrashMask of the Node More...
 
Vec3 getPosition () const
 returns the position of the node More...
 
Quaternion getRotation () const
 returns the rotation of the node More...
 
Vec3 getScale () const
 returns the scale of the node More...
 
void applyRotation (const Quaternion &rotation, int64_t id)
 applies the new rotation transforming rotation and forces More...
 
api::ShatterInterest getShatterInterest () const
 get the collision interest More...
 
void Tick ()
 called during every physics tick More...
 
void createVelocityComponent (double maxSpeed, double resistanceCoefficient, double windage)
 creates a new VelocityComponent More...
 
void deleteVelocityComponent ()
 deletes a VelocityComponent More...
 

Friends

class PhysicsMailbox
 
class PhysicsManager
 
class PhysicsVelocityComponent
 

Detailed Description

Represents the physical state of an object simulated by the Bullet library. Contains the btTransform and a pointer to the associated rigidBody.

The class is responsible for signing rigidBodys in and out the PhysicsController.

Update Mechanism for positioning:

msc_inline_mscgraph_1

Definition at line 81 of file PhysicsNode.h.

Constructor & Destructor Documentation

i6e::modules::PhysicsNode::PhysicsNode ( const int64_t  id,
const int64_t  compId,
const Vec3 position,
const Quaternion rotation,
const Vec3 scale,
const api::CollisionGroup cg,
const api::attributeMap params,
api::ShatterInterest  shatterInterest,
PhysicsManager pm 
)

constructor

i6e::modules::PhysicsNode::~PhysicsNode ( )

destructor

Member Function Documentation

bool i6e::modules::PhysicsNode::addChild ( const int64_t  compId,
const Vec3 position,
const Quaternion rotation,
const Vec3 scale,
const api::CollisionGroup cg,
const api::PhysicalStateComponent::ShapeType  shapeType,
const api::attributeMap shapeParams 
)

adds a new child shape to this node

void i6e::modules::PhysicsNode::applyRotation ( const Quaternion rotation,
int64_t  id 
)

applies the new rotation transforming rotation and forces

void i6e::modules::PhysicsNode::createVelocityComponent ( double  maxSpeed,
double  resistanceCoefficient,
double  windage 
)

creates a new VelocityComponent

void i6e::modules::PhysicsNode::deleteVelocityComponent ( )

deletes a VelocityComponent

bool i6e::modules::PhysicsNode::empty ( ) const
int64_t i6e::modules::PhysicsNode::getCompID ( ) const
inline

Definition at line 165 of file PhysicsNode.h.

uint32_t i6e::modules::PhysicsNode::getCrashMask ( )
inline

returns the CrashMask of the Node

Definition at line 196 of file PhysicsNode.h.

uint32_t i6e::modules::PhysicsNode::getCrashType ( )
inline

returns the CrashType of the Node

Definition at line 172 of file PhysicsNode.h.

int64_t i6e::modules::PhysicsNode::getID ( ) const
inline

returns the GO id of the Node

Definition at line 161 of file PhysicsNode.h.

Vec3 i6e::modules::PhysicsNode::getPosition ( ) const
inline

returns the position of the node

Definition at line 201 of file PhysicsNode.h.

btRigidBody* i6e::modules::PhysicsNode::getRigidBody ( ) const
inline

returns the rigidBody of the PhysicsNode

Definition at line 151 of file PhysicsNode.h.

Quaternion i6e::modules::PhysicsNode::getRotation ( ) const
inline

returns the rotation of the node

Definition at line 206 of file PhysicsNode.h.

Vec3 i6e::modules::PhysicsNode::getScale ( ) const
inline

returns the scale of the node

Definition at line 211 of file PhysicsNode.h.

api::ShatterInterest i6e::modules::PhysicsNode::getShatterInterest ( ) const
inline

get the collision interest

Definition at line 221 of file PhysicsNode.h.

void i6e::modules::PhysicsNode::getWorldTransform ( btTransform &  worldTrans) const
inline

Called by Bullet when the object is first scheduled for simulation to retrieve the initial transform.

Definition at line 141 of file PhysicsNode.h.

api::RayTestResult i6e::modules::PhysicsNode::HitTest ( const Vec3 from,
const Vec3 to 
)

Tests a Hit with a ray given by the vector.

void i6e::modules::PhysicsNode::removeChild ( int64_t  compId)

removes a child shape

void i6e::modules::PhysicsNode::reset ( )

Clears all forces and sets the velocity to 0, so that e.g. a bike after shattering doesn't still move after resetting.

void i6e::modules::PhysicsNode::setCollisionFlags ( const api::CollisionGroup cg)

sets the collision flags of the Node

void i6e::modules::PhysicsNode::setCrashMask ( uint32_t  cm)
inline

sets the crash mask of the Node

Definition at line 189 of file PhysicsNode.h.

void i6e::modules::PhysicsNode::setCrashType ( uint32_t  ct)
inline

sets the crashtype of the node

Definition at line 182 of file PhysicsNode.h.

void i6e::modules::PhysicsNode::setPosition ( const Vec3 position,
int64_t  id 
)

Override from PhysicalStateComponent to update internal transform. Sets new position by calling PhysicalStateComponent::SetPosition(const Vec3 position) and updates internal transform PhysicsNode::_transform.

Parameters
[in]positionnew position
void i6e::modules::PhysicsNode::setRotation ( const Quaternion rotation,
int64_t  id 
)

Override from PhysicalStateComponent to update internal transform. Sets new rotation by calling PhysicalStateComponent::setRotation(const Quaternion rotation) and updates internal transform PhysicsNode::_transform.

Parameters
[in]rotationnew rotation
void i6e::modules::PhysicsNode::setScale ( const Vec3 scale,
int64_t  id 
)

Override from PhysicalStateComponent to update internal transform. Sets new scale by calling PhysicalStateComponent::setScale(Vec3 scale).

Parameters
[in]scalenew scale
void i6e::modules::PhysicsNode::setWorldTransform ( const btTransform &  worldTrans)

Called by Bullet when the simulated object has moved.

void i6e::modules::PhysicsNode::Tick ( )

called during every physics tick

Friends And Related Function Documentation

friend class PhysicsMailbox
friend

Definition at line 82 of file PhysicsNode.h.

friend class PhysicsManager
friend

Definition at line 83 of file PhysicsNode.h.

friend class PhysicsVelocityComponent
friend

Definition at line 84 of file PhysicsNode.h.


The documentation for this class was generated from the following file: