igor::iPhysicsBody Class Reference

#include <iPhysicsBody.h>

Public Member Functions

void setMatrix (const iaMatrixd &matrix)
 
void getMatrix (iaMatrixd &matrix)
 
void getTransformNodeMatrix (iaMatrixd &matrix) const
 
void setMass (float64 mass)
 
float64 getMass ()
 
void setAngularDamping (const iaVector3d &damping)
 
const iaVector3dgetAngularDamping () const
 
void setLinearDamping (float64 damping)
 
float64 getLinearDamping () const
 
const iaVector3dgetForce () const
 
void setForce (const iaVector3d &force)
 
void setUserData (const std::any &userData)
 
std::any getUserData () const
 
const iaVector3dgetTorque () const
 
void setTorque (const iaVector3d &torque)
 
iaVector3d getVelocity () const
 
const iaVector3dgetOmega () const
 
uint32 getTransformNodeID () const
 
void setMaterial (int64 id)
 
int64 getMaterial () const
 
iPhysicsBodyID getID ()
 
void * getNewtonBody ()
 
void registerForceAndTorqueDelegate (iApplyForceAndTorqueDelegate applyForceAndTorqueDelegate)
 
void unregisterForceAndTorqueDelegate (iApplyForceAndTorqueDelegate applyForceAndTorqueDelegate)
 

Static Public Attributes

static const uint64 INVALID_PHYSICSBODY_ID = 0
 

Protected Member Functions

void setTransformNodeMatrix (const iaMatrixd &matrix)
 
void setOmega (const iaVector3d &omega)
 
void applyForceAndTorque (float64 timeStep)
 
 iPhysicsBody (void *newtonBody)
 
 ~iPhysicsBody ()
 

Protected Attributes

int64 _materialID = iPhysicsMaterial::INVALID_PHYSICSMATERIAL_ID
 
iPhysicsBodyID _id = INVALID_PHYSICSBODY_ID
 
std::any _userData
 
float64 _mass = 0
 
iaVector3d _angularDamping
 
float64 _linearDamping
 
iaVector3d _force
 
iaVector3d _torque
 
iaVector3d _velocity
 
iaVector3d _omega
 
void * _newtonBody = nullptr
 
uint32 _transformNodeID = iNode::INVALID_NODE_ID
 

Static Protected Attributes

static iaIDGenerator64 _idGenerator
 

Friends

class iPhysics
 
void PhysicsNodeDestructor (const void *body)
 
void PhysicsApplyForceAndTorque (const void *body, float64 timestep, int threadIndex)
 
void PhysicsNodeSetTransform (const void *body, const float *matrix, int threadIndex)
 

Detailed Description

wrapper for the NewtonBody handle

Constructor & Destructor Documentation

◆ iPhysicsBody()

igor::iPhysicsBody::iPhysicsBody ( void *  newtonBody)
protected

initializes newton body handle

Parameters
newtonBodyhandle to newton body

◆ ~iPhysicsBody()

igor::iPhysicsBody::~iPhysicsBody ( )
protected

dtor

releases newton collision

Member Function Documentation

◆ applyForceAndTorque()

void igor::iPhysicsBody::applyForceAndTorque ( float64  timeStep)
protected

triggers callback for user implementation of applyForceAndTorque

called by iPhysics

Parameters
timeStepdelta of time since last update

◆ getAngularDamping()

const iaVector3d & igor::iPhysicsBody::getAngularDamping ( ) const
Returns
damping values for all 3 axis

◆ getForce()

const iaVector3d & igor::iPhysicsBody::getForce ( ) const
Returns
current force

◆ getID()

uint64 igor::iPhysicsBody::getID ( )
Returns
body ID

◆ getLinearDamping()

float64 igor::iPhysicsBody::getLinearDamping ( ) const
Returns
linear damping value

◆ getMass()

float64 igor::iPhysicsBody::getMass ( )
Returns
mass of body

◆ getMaterial()

int64 igor::iPhysicsBody::getMaterial ( ) const
Returns
physics material id

◆ getMatrix()

void igor::iPhysicsBody::getMatrix ( iaMatrixd matrix)

returns current body matrix

Parameters
[out]matrixcurrent body matrix

◆ getNewtonBody()

void * igor::iPhysicsBody::getNewtonBody ( )
Returns
pointer to newton body

◆ getOmega()

const iaVector3d & igor::iPhysicsBody::getOmega ( ) const
Returns
current omega (or rotation speed)

◆ getTorque()

const iaVector3d & igor::iPhysicsBody::getTorque ( ) const
Returns
current torque

◆ getTransformNodeID()

uint32 igor::iPhysicsBody::getTransformNodeID ( ) const
Returns
transform node id

returns zero if body is not bound to a transform node

◆ getTransformNodeMatrix()

void igor::iPhysicsBody::getTransformNodeMatrix ( iaMatrixd matrix) const

returns the transform node materix

the transform node matrix is affected by the bodys movement within the physics context (see setTransformNodeMatrix) returns identity materix if body is not bound to a transform node

Parameters
matrix[out]destination to put the matrix in

◆ getUserData()

std::any igor::iPhysicsBody::getUserData ( ) const
Returns
pointer to user data

◆ getVelocity()

iaVector3d igor::iPhysicsBody::getVelocity ( ) const
Returns
current velocity

◆ registerForceAndTorqueDelegate()

void igor::iPhysicsBody::registerForceAndTorqueDelegate ( iApplyForceAndTorqueDelegate  applyForceAndTorqueDelegate)

registers to apply force and tourque event

Parameters
applyForceAndTorqueDelegatethe delegate to register

◆ setAngularDamping()

void igor::iPhysicsBody::setAngularDamping ( const iaVector3d damping)

sets angular damping

Parameters
dampingdamping values for all 3 axis

◆ setForce()

void igor::iPhysicsBody::setForce ( const iaVector3d force)

sets force

Parameters
forcethe force that affect thos body

◆ setLinearDamping()

void igor::iPhysicsBody::setLinearDamping ( float64  damping)

sets linear damping

Parameters
dampingdamping value for all 3 dimensions

◆ setMass()

void igor::iPhysicsBody::setMass ( float64  mass)

changes the mass of the newton body

Parameters
massthe mass of the newton body (if zero the body is considered to be a non moveable object).

◆ setMaterial()

void igor::iPhysicsBody::setMaterial ( int64  id)

sets material id

Parameters
idphysics material id

◆ setMatrix()

void igor::iPhysicsBody::setMatrix ( const iaMatrixd matrix)

sets matrix of newton body

Parameters
matrixthe matrix for the newton body

◆ setOmega()

void igor::iPhysicsBody::setOmega ( const iaVector3d omega)
protected

updates the omega by physics event

is called by iPhysics after the body changed it's position

Parameters
omegathe omega to set

◆ setTorque()

void igor::iPhysicsBody::setTorque ( const iaVector3d torque)

sets torque of the body

Parameters
torquethe torque to set

◆ setTransformNodeMatrix()

void igor::iPhysicsBody::setTransformNodeMatrix ( const iaMatrixd matrix)
protected

updates the transform node matrix by physics event

is called by iPhysics after the body changed it's position

Parameters
matrixmatrix to be set

◆ setUserData()

void igor::iPhysicsBody::setUserData ( const std::any &  userData)

sets user data

Parameters
userDatapointer to user data

◆ unregisterForceAndTorqueDelegate()

void igor::iPhysicsBody::unregisterForceAndTorqueDelegate ( iApplyForceAndTorqueDelegate  applyForceAndTorqueDelegate)

unregisters from apply force and tourque event

Parameters
applyForceAndTorqueDelegatethe delegate to unregister

Friends And Related Function Documentation

◆ iPhysics

friend class iPhysics
friend

◆ PhysicsApplyForceAndTorque

void PhysicsApplyForceAndTorque ( const void *  body,
float64  timestep,
int  threadIndex 
)
friend

redirects all apply force and torque calls to igor physics bodies

Parameters
bodythe newton body
timesteptime delta
threadIndex???

◆ PhysicsNodeDestructor

void PhysicsNodeDestructor ( const void *  body)
friend

callback for physics body destruction

Parameters
bodypointer to body that got destroyed

◆ PhysicsNodeSetTransform

void PhysicsNodeSetTransform ( const void *  body,
const float *  matrix,
int  threadIndex 
)
friend

Member Data Documentation

◆ _angularDamping

iaVector3d igor::iPhysicsBody::_angularDamping
protected

current angular damping

◆ _force

iaVector3d igor::iPhysicsBody::_force
protected

current force

◆ _id

iPhysicsBodyID igor::iPhysicsBody::_id = INVALID_PHYSICSBODY_ID
protected

body id

◆ _idGenerator

iaIDGenerator64 igor::iPhysicsBody::_idGenerator
staticprotected

next body id

◆ _linearDamping

float64 igor::iPhysicsBody::_linearDamping
protected

current linear damping

◆ _mass

float64 igor::iPhysicsBody::_mass = 0
protected

the mass of this body

◆ _materialID

int64 igor::iPhysicsBody::_materialID = iPhysicsMaterial::INVALID_PHYSICSMATERIAL_ID
protected

material id of body

◆ _newtonBody

void* igor::iPhysicsBody::_newtonBody = nullptr
protected

handle to newton body

◆ _omega

iaVector3d igor::iPhysicsBody::_omega
protected

current omega or angular speed

◆ _torque

iaVector3d igor::iPhysicsBody::_torque
protected

current torque

◆ _transformNodeID

uint32 igor::iPhysicsBody::_transformNodeID = iNode::INVALID_NODE_ID
protected

bound transform node

◆ _userData

std::any igor::iPhysicsBody::_userData
protected

user data

◆ _velocity

iaVector3d igor::iPhysicsBody::_velocity
protected

current velocity

◆ INVALID_PHYSICSBODY_ID

const uint64 igor::iPhysicsBody::INVALID_PHYSICSBODY_ID = 0
static

defines the invalid body id


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