igor::iPhysics Class Reference

#include <iPhysics.h>

Inherits igor::iModule< iPhysics >.

Public Member Functions

void setSimulationRate (float64 simulationRate)
 
float64 getSimulationRate ()
 
void start ()
 
void stop ()
 
iPhysicsMaterialcreateMaterial (const iaString &name)
 
iPhysicsCollisiongetCollision (uint64 collisionID)
 
void destroyCollision (iPhysicsCollision *collision)
 
void destroyCollision (uint64 collisionID)
 
iPhysicsWorldcreateWorld ()
 
iPhysicsWorldgetWorld (uint64 id)
 
uint64 getDefaultWorldID ()
 
void destroyWorld (uint64 id)
 
void destroyWorld (iPhysicsWorld *world)
 
bool isWorld (uint64 id)
 
void convexCast (const iaMatrixd &matrix, const iaVector3d &target, iPhysicsCollision *collisionVolume, iRayPreFilterDelegate preFilterDelegate, void *userData, std::vector< iConvexCastReturnInfo > &result, int32 maxContactCount=10)
 
iPhysicsCollisionConfigcreateCollisionConfig ()
 
iPhysicsCollisionConfiggetCollisionConfig (uint64 collisionConfigID)
 
void destroyCollisionConfig (uint64 collisionConfigID)
 
void destroyCollisionConfig (iPhysicsCollisionConfig *physicsCollisionConfig)
 
bool isCollisionConfig (uint64 collisionConfigID)
 
iPhysicsJointcreateJoint (iPhysicsBody *body0, iPhysicsBody *body1=nullptr, int maxDOF=6)
 
iPhysicsJointgetJoint (uint64 jointID)
 
bool isJoint (uint64 jointID)
 
iPhysicsMaterialgetMaterial (int64 id)
 
int64 getMaterialID (const iaString &name)
 
void setMaterial (iPhysicsBody *body, int64 materialID)
 
iPhysicsMaterialgetDefaultShader ()
 
int64 getDefaultMaterialID ()
 
iPhysicsBodycreateBody (iPhysicsCollision *collisionVolume)
 
void destroyBody (iPhysicsBody *body)
 
void destroyBodyAsync (iPhysicsBody *body)
 
void destroyBody (uint64 bodyID)
 
iPhysicsBodygetBody (uint64 bodyID)
 
bool isBody (uint64 bodyID)
 
iPhysicsCollisioncreateBox (float64 width, float64 height, float64 depth, const iaMatrixd &offset)
 
iPhysicsCollisioncreateMesh (iMeshPtr mesh, int64 faceAttribute, const iaMatrixd &offset)
 
iPhysicsCollisioncreateSphere (float64 radius, const iaMatrixd &offset)
 
iPhysicsCollisioncreateCone (float64 radius, float64 height, const iaMatrixd &offset)
 
iPhysicsCollisioncreateCapsule (float64 radius0, float64 radius1, float64 height, const iaMatrixd &offset)
 
iPhysicsCollisioncreateCylinder (float64 radius0, float64 radius1, float64 height, const iaMatrixd &offset)
 
iPhysicsCollisioncreateCompound (std::vector< iPhysicsCollision * > &collisions)
 
void getMassMatrix (void *newtonBody, float64 &mass, float64 &Ixx, float64 &Iyy, float64 &Izz)
 
void setMassMatrix (void *newtonBody, float64 mass, float64 Ixx, float64 Iyy, float64 Izz)
 
void setUserJointAddAngularRow (iPhysicsJoint *joint, float64 relativeAngleError, const iaVector3d &pin)
 
void setUserJointSetRowMinimumFriction (iPhysicsJoint *joint, float64 friction)
 
void setUserJointSetRowMaximumFriction (iPhysicsJoint *joint, float64 friction)
 
void bindTransformNode (iPhysicsBody *body, iNodeTransform *transformNode, bool sync=true)
 

Friends

class iModule< iPhysics >
 
class iPhysicsCollision
 
class iTaskPhysics
 
class iPhysicsBody
 
class iPhysicsMaterialCombo
 
class iPhysicsCollisionConfig
 
class iApplication
 
void PhysicsNodeDestructor (const void *body)
 
void PhysicsNodeSetTransform (const void *body, const float64 *matrix, int threadIndex)
 
void GenericContactProcessCompatible (const void *const newtonContactJoint, float64 timestep, int threadIndex)
 

Additional Inherited Members

- Static Public Member Functions inherited from igor::iModule< iPhysics >
static IGOR_INLINE iPhysicsgetInstance ()
 
static IGOR_INLINE bool isInstantiated ()
 
static void create ()
 
static void destroy ()
 
- Protected Member Functions inherited from igor::iModule< iPhysics >
 iModule ()=default
 
virtual ~iModule ()=default
 

Detailed Description

wrapper for newton game dynamics

Member Function Documentation

◆ bindTransformNode()

void igor::iPhysics::bindTransformNode ( iPhysicsBody body,
iNodeTransform transformNode,
bool  sync = true 
)

binds transform node to newton body

Parameters
bodyhandle to newton body
transformNodetransform node to bind
syncif true the bodys matrix will be updated with the transform node one

◆ convexCast()

void igor::iPhysics::convexCast ( const iaMatrixd matrix,
const iaVector3d target,
iPhysicsCollision collisionVolume,
iRayPreFilterDelegate  preFilterDelegate,
void *  userData,
std::vector< iConvexCastReturnInfo > &  result,
int32  maxContactCount = 10 
)

◆ createBody()

iPhysicsBody * igor::iPhysics::createBody ( iPhysicsCollision collisionVolume)

creates a newton body and connects it with a newton collision

Parameters
bodythe collision to connect with
Returns
shared pointer to newton body

◆ createBox()

iPhysicsCollision * igor::iPhysics::createBox ( float64  width,
float64  height,
float64  depth,
const iaMatrixd offset 
)

creates newton collision in shape of a box

Parameters
widthwidth of box
heightheight of box
depthdepth of box
offsetmatrix as offset to origin
Returns
physics collision

◆ createCapsule()

iPhysicsCollision * igor::iPhysics::createCapsule ( float64  radius0,
float64  radius1,
float64  height,
const iaMatrixd offset 
)

creates newton collision in shape of a capsule

Parameters
radiusradius of capsule
heightheight of capsule
offsetmatrix as offset to origin
Returns
physics collision

◆ createCollisionConfig()

iPhysicsCollisionConfig * igor::iPhysics::createCollisionConfig ( )

creates a collision configuration

Returns
pointer to collision configuration

◆ createCompound()

iPhysicsCollision * igor::iPhysics::createCompound ( std::vector< iPhysicsCollision * > &  collisions)

creates a collision compound from multiple collisions

Parameters
collisionslist od collisions
Returns
a compound collision

◆ createCone()

iPhysicsCollision * igor::iPhysics::createCone ( float64  radius,
float64  height,
const iaMatrixd offset 
)

creates newton collision in shape of a cone

Parameters
radiusradius of cone
heightheight of cone
offsetmatrix as offset to origin
Returns
physics collision

◆ createCylinder()

iPhysicsCollision * igor::iPhysics::createCylinder ( float64  radius0,
float64  radius1,
float64  height,
const iaMatrixd offset 
)

creates newton collision in shape of a cylinder

Parameters
radiusradius of cylinder
heightheight of cylinder
offsetmatrix as offset to origin
Returns
physics collision

◆ createJoint()

iPhysicsJoint * igor::iPhysics::createJoint ( iPhysicsBody body0,
iPhysicsBody body1 = nullptr,
int  maxDOF = 6 
)

creates a joint

◆ createMaterial()

iPhysicsMaterial * igor::iPhysics::createMaterial ( const iaString name)

creates a material

Returns
pointer to new material

◆ createMesh()

iPhysicsCollision * igor::iPhysics::createMesh ( iMeshPtr  mesh,
int64  faceAttribute,
const iaMatrixd offset 
)

creates a collision shape based on a mesh

Parameters
meshthe mesh
faceAttributean integer attribute associated with the faces
offsetlocal offset matrix
Returns
physics collision

◆ createSphere()

iPhysicsCollision * igor::iPhysics::createSphere ( float64  radius,
const iaMatrixd offset 
)

creates newton collision in shape of a sphere

Parameters
radiusradius of sphere
offsetmatrix as offset to origin
Returns
physics collision

◆ createWorld()

iPhysicsWorld * igor::iPhysics::createWorld ( )

creates a world

Returns
pointer to world

◆ destroyBody() [1/2]

void igor::iPhysics::destroyBody ( iPhysicsBody body)

destroy physics body

Parameters
bodythe body to destroy

◆ destroyBody() [2/2]

void igor::iPhysics::destroyBody ( uint64  bodyID)

destrox body by ID

Parameters
bodyIDthe ID of the body to be destroyed

◆ destroyBodyAsync()

void igor::iPhysics::destroyBodyAsync ( iPhysicsBody body)

destroy physics body (asynchronous)

Parameters
bodythe body to destroy

◆ destroyCollision() [1/2]

void igor::iPhysics::destroyCollision ( iPhysicsCollision collision)

destroys physics collision

Parameters
collisionthe collision to destroy

◆ destroyCollision() [2/2]

void igor::iPhysics::destroyCollision ( uint64  collisionID)

destroys collision by id

Parameters
collisionIDthe collisions id

◆ destroyCollisionConfig() [1/2]

void igor::iPhysics::destroyCollisionConfig ( iPhysicsCollisionConfig physicsCollisionConfig)

destroy collision configuration

Parameters
physicsCollisionConfigthe collision configuration to destroy

◆ destroyCollisionConfig() [2/2]

void igor::iPhysics::destroyCollisionConfig ( uint64  collisionConfigID)

destroy collision configuration by id

Parameters
collisionConfigIDcollision configuration id

◆ destroyWorld() [1/2]

void igor::iPhysics::destroyWorld ( iPhysicsWorld world)

destroy world

Parameters
worldthe world to destroy

◆ destroyWorld() [2/2]

void igor::iPhysics::destroyWorld ( uint64  id)

destroy world by id

Parameters
idworld id

◆ getBody()

iPhysicsBody * igor::iPhysics::getBody ( uint64  bodyID)
Returns
body by given ID

\pram bodyID the body's ID

◆ getCollision()

iPhysicsCollision * igor::iPhysics::getCollision ( uint64  collisionID)
Returns
collision by id
Parameters
collisionIDthe collision id

◆ getCollisionConfig()

iPhysicsCollisionConfig * igor::iPhysics::getCollisionConfig ( uint64  collisionConfigID)
Returns
collision configuration by id
Parameters
collisionConfigIDcollision configuration id

◆ getDefaultMaterialID()

int64 igor::iPhysics::getDefaultMaterialID ( )
Returns
the default material id

◆ getDefaultShader()

iPhysicsMaterial * igor::iPhysics::getDefaultShader ( )
Returns
the default material

◆ getDefaultWorldID()

uint64 igor::iPhysics::getDefaultWorldID ( )
Returns
default world id

◆ getJoint()

iPhysicsJoint * igor::iPhysics::getJoint ( uint64  jointID)
Returns
joint by id
Parameters
jointIDthe joint id

◆ getMassMatrix()

void igor::iPhysics::getMassMatrix ( void *  newtonBody,
float64 mass,
float64 Ixx,
float64 Iyy,
float64 Izz 
)

returns the mass matrix from given body

Parameters
newtonBodythe newton body
massthe returned mass
Ixx???
Iyy???
Izz???

◆ getMaterial()

iPhysicsMaterial * igor::iPhysics::getMaterial ( int64  id)
Returns
physics material by ID
Parameters
idthe id of the physics material

◆ getMaterialID()

int64 igor::iPhysics::getMaterialID ( const iaString name)
Returns
material id by name
Parameters
namethe name of the material

◆ getSimulationRate()

float64 igor::iPhysics::getSimulationRate ( )
Returns
simulation rate

◆ getWorld()

iPhysicsWorld * igor::iPhysics::getWorld ( uint64  id)
Returns
world by id
Parameters
idworld id

◆ isBody()

bool igor::iPhysics::isBody ( uint64  bodyID)
Returns
true if id belongs to a body

◆ isCollisionConfig()

bool igor::iPhysics::isCollisionConfig ( uint64  collisionConfigID)
Returns
true if id belongs to a collision configuration
Parameters
collisionConfigIDid of collision configuration

◆ isJoint()

bool igor::iPhysics::isJoint ( uint64  jointID)
Returns
true if id is a joint
Parameters
jointIDthe joint id

◆ isWorld()

bool igor::iPhysics::isWorld ( uint64  id)
Returns
true if id belongs to a world
Parameters
idid of world

◆ setMassMatrix()

void igor::iPhysics::setMassMatrix ( void *  newtonBody,
float64  mass,
float64  Ixx,
float64  Iyy,
float64  Izz 
)

the mass matrix of newton body

Parameters
newtonBodyhandle to newton body
massmass of newton body
Ixx???
Iyy???
Izz???

◆ setMaterial()

void igor::iPhysics::setMaterial ( iPhysicsBody body,
int64  materialID 
)

configures material for body

Parameters
bodythe body to configure the material
materialIDthe material's id to set

◆ setSimulationRate()

void igor::iPhysics::setSimulationRate ( float64  simulationRate)

set's the simulation rate in Hz

default is 120Hz

Parameters
simulationRatesimulation rate in Hz

◆ setUserJointAddAngularRow()

void igor::iPhysics::setUserJointAddAngularRow ( iPhysicsJoint joint,
float64  relativeAngleError,
const iaVector3d pin 
)

◆ setUserJointSetRowMaximumFriction()

void igor::iPhysics::setUserJointSetRowMaximumFriction ( iPhysicsJoint joint,
float64  friction 
)

◆ setUserJointSetRowMinimumFriction()

void igor::iPhysics::setUserJointSetRowMinimumFriction ( iPhysicsJoint joint,
float64  friction 
)

◆ start()

void igor::iPhysics::start ( )

registers handle to application handle event

◆ stop()

void igor::iPhysics::stop ( )

unregisters handle from application handle event

Friends And Related Function Documentation

◆ GenericContactProcessCompatible

void GenericContactProcessCompatible ( const void *const  newtonContactJoint,
float64  timestep,
int  threadIndex 
)
friend

generic handle to handle contacts between two bodies

Parameters
newtonContactJointthe contact joint
timesteptime delta
threadIndexthread index

◆ iApplication

friend class iApplication
friend

◆ iModule< iPhysics >

friend class iModule< iPhysics >
friend

◆ iPhysicsBody

friend class iPhysicsBody
friend

◆ iPhysicsCollision

friend class iPhysicsCollision
friend

◆ iPhysicsCollisionConfig

friend class iPhysicsCollisionConfig
friend

◆ iPhysicsMaterialCombo

friend class iPhysicsMaterialCombo
friend

◆ iTaskPhysics

friend class iTaskPhysics
friend

◆ 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 float64 matrix,
int  threadIndex 
)
friend

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