DigitalSpaces::DIPhysics Struct Reference
[Physics]

#include <Physics.h>

Inherits DigitalSpaces::DIObjectBase.


Detailed Description

Factory for Physics Worlds.

In general usage, a developer should only need to use this interface for setting up collision listeners. The creation of a DIPhysicsWorld should be handled through the SceneGraph, which will create a single default DIPhysicsWorld if given physics related parameters in the <environment> configuration section of a .scene file. Most simulations will not need to run more then 1 physics world at a time, as objects connot interact between worlds at all.

When accessed through scripting, this DInterface also contains:

                void SetContactsBetweenShapes( const std::set<std::string>& setA, const std::set<std::string>& setB, const tSettingDict& settingDict )

set<string> is provided via a Python set (of strings), and tSettingDict is a Python dict of string to vector/quaternion/bool/float values. This function should be integrated into the interface at a binary level, in future.


Public Member Functions

float GetGlobalScale ()
 Get the internal scaling of the physics simulation.
void GetCollisionsLastHeartbeat (DIStringPairList *collidedShapes)
 A helper method for when using a DIPhysicsShapeCollisionListener isn't practical.
DIPhysicsRayCreateRay (const char *name)
 Create a ray for testing against a physics world.
DIPhysicsRayFindRay (const char *name)
 Retreive a ray that was previously created.
void DestroyRay (const char *name)
 Destroy a previously created ray.
Physics World Functions
DIPhysicsWorldCreateWorld (const char *sWorldName)
 Create a physics world for simulation.
DIPhysicsWorldFindWorld (const char *sWorldName)
 Return a physics world that was previously created.
void DestroyWorld (DIPhysicsWorld *pWorld)
 Destroy a physics world.
Listener Functions
void AddBodyMovementListener (DIPhysicsBodyMovementListener *listener)
void AddShapeCollisionListener (DIPhysicsShapeCollisionListener *listener)
 Allows an implementation to gather information about collisions as they occur, and to customize the simulations reaction to the collision.
void AddWorldStepListener (DIPhysicsWorldStepListener *listener)

Member Function Documentation

DIPhysicsWorld* DigitalSpaces::DIPhysics::CreateWorld ( const char *  sWorldName  ) 

Create a physics world for simulation.

Parameters:
sWorldName A unique name for the physics world.
Returns:
Interface to the new world, or NULL of the provided name is not unique.

DIPhysicsWorld* DigitalSpaces::DIPhysics::FindWorld ( const char *  sWorldName  ) 

Return a physics world that was previously created.

Parameters:
sWorldName Unique name to search for.
Returns:
Interface to the specified physics world, or NULL of the world is not found.

void DigitalSpaces::DIPhysics::DestroyWorld ( DIPhysicsWorld pWorld  ) 

Destroy a physics world.

Parameters:
pWorld Interface to an existing world, retreived with CreateWorld or FindWorld.
Note:
Calling this function invalidates the DIPhysicsWorld interface. Be careful when destroying worlds, if they are in use by another component this will cause a crash when a component attempts to access it.

void DigitalSpaces::DIPhysics::AddBodyMovementListener ( DIPhysicsBodyMovementListener listener  ) 

Deprecated:
Use PerformHeartbeat instead, and SceneGraph (DISGNode). Doesn't do anything in the current reference implementation.

void DigitalSpaces::DIPhysics::AddShapeCollisionListener ( DIPhysicsShapeCollisionListener listener  ) 

Allows an implementation to gather information about collisions as they occur, and to customize the simulations reaction to the collision.

When any collisions occur, in any worlds, the object implementation DIPhysicsShapeCollisionListener will be called with an interface that provides both information about the collision, and functions to set how the simulation will react.

Note:
When used through the scripting interface, rather then passing an object which implements DIPhysicsShapeCollisionListener, you can pass a function (or method), which will be called with the same parameters as DIPhysicsShapeCollisionListener::OnShapeCollision.

void DigitalSpaces::DIPhysics::AddWorldStepListener ( DIPhysicsWorldStepListener listener  ) 

Deprecated:
Use PerformHeartbeat instead, and SceneGraph (DISGNode). Doesn't do anything in the current reference implementation.

float DigitalSpaces::DIPhysics::GetGlobalScale (  ) 

Get the internal scaling of the physics simulation.

Deprecated:
This was implemented as a fix to what seemed to be a precision loss issue when dealing with simulations of over 1000 units in distance. The current implementation does not support setting global scale (which could only be configured through DIAcceptConfiguration1).

void DigitalSpaces::DIPhysics::GetCollisionsLastHeartbeat ( DIStringPairList collidedShapes  ) 

A helper method for when using a DIPhysicsShapeCollisionListener isn't practical.

Also useful for when you will never be changing the simulations reaction at the time of collision, and are only collecting data about what happened.

Note:
This is particularly useful with the scripting extension function SetContactsBetweenShapes.

DIPhysicsRay* DigitalSpaces::DIPhysics::CreateRay ( const char *  name  ) 

Create a ray for testing against a physics world.

Parameters:
name Unique identifier for the ray.
Returns:
Interface to the created ray, or NULL if the provided name is not unique.

DIPhysicsRay* DigitalSpaces::DIPhysics::FindRay ( const char *  name  ) 

Retreive a ray that was previously created.

Parameters:
name Unique name of a ray.
Returns:
Interface to the specified ray, or NULL if the ray has not been created.

void DigitalSpaces::DIPhysics::DestroyRay ( const char *  name  ) 

Destroy a previously created ray.

Parameters:
name Unique name of a ray.


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

Generated on Sun Aug 31 17:46:28 2008 for Digital Spaces by  doxygen 1.5.6