DigitalSpaces::DIPhysicsRay Struct Reference
[Physics]

#include <Physics.h>

Inherits DigitalSpaces::DIObjectBase.


Detailed Description

Wraps the implementation of a ray collision test.

This allows testing against a DIPhysicsWorld to determine the first Shape collided with. This does not happen as part of the normal simulation collision detection. Provided by DIPhysics::CreateRay


Public Member Functions

void SetRayPosition (in_Vector3f *position)
 Set the position the ray test is performed from.
void SetRayDirection (in_Vector3f *direction)
 Set the direction the ray test is performed in.
void SetRayLength (float length)
 Set the length (distance) of the ray test.
void GetRayPosition (out_Vector3f *position)
 Retrieve the position the ray test is performed from.
void GetRayDirection (out_Vector3f *direction)
 Retrieve the direction the ray test is performed along.
float GetRayLength ()
 Retreive the maximum distance the ray test detects.
bool TestAgainstWorld (const char *worldName)
 Test the ray against a physics world.
bool TestAgainstWorld (DIPhysicsWorld *world)
 Test the ray against a physics world.
DIPhysicsShapeGetShapeFromLastTest ()
 Return the shape that was collided with during the last successful call to TestAgainstWorld.
float GetDistanceFromLastTest ()
 Returns the distance of the collision during the last successul call to TestAgainstWorld.
void GetPositionFromLastTest (out_Vector3f *position)
 Retreives the position of the collision during the last successul call to TestAgainstWorld.
void GetNormalFromLastTest (out_Vector3f *normal)
 Retreives the normal of the surface collided with during the last successul call to TestAgainstWorld.

Member Function Documentation

void DigitalSpaces::DIPhysicsRay::SetRayPosition ( in_Vector3f position  ) 

Set the position the ray test is performed from.

Parameters:
position Position the ray is to test from, in world coordinates.

void DigitalSpaces::DIPhysicsRay::SetRayDirection ( in_Vector3f direction  ) 

Set the direction the ray test is performed in.

Parameters:
direction Direction to perform the ray test along. This is in world coordinates.

void DigitalSpaces::DIPhysicsRay::SetRayLength ( float  length  ) 

Set the length (distance) of the ray test.

Parameters:
length Maximum distance to test for ray testing. In world coordinates (no scaling).
Todo:
Add an infinite option?

void DigitalSpaces::DIPhysicsRay::GetRayPosition ( out_Vector3f position  ) 

Retrieve the position the ray test is performed from.

Parameters:
[out] position Position the ray is tested from, in world coordinates.

void DigitalSpaces::DIPhysicsRay::GetRayDirection ( out_Vector3f direction  ) 

Retrieve the direction the ray test is performed along.

Parameters:
[out] direction The direction the ray test is performed along, in world coordinates.

float DigitalSpaces::DIPhysicsRay::GetRayLength (  ) 

Retreive the maximum distance the ray test detects.

Returns:
The maximum distance the test will check. In world coordinates (no scaling).

bool DigitalSpaces::DIPhysicsRay::TestAgainstWorld ( const char *  worldName  ) 

Test the ray against a physics world.

Parameters:
worldName The name of the world to test against.
Returns:
True if a collision occured, false otherwise.

bool DigitalSpaces::DIPhysicsRay::TestAgainstWorld ( DIPhysicsWorld world  ) 

Test the ray against a physics world.

Parameters:
world The interface of the world to test against.
Returns:
True if a collision occured, false otherwise.

DIPhysicsShape* DigitalSpaces::DIPhysicsRay::GetShapeFromLastTest (  ) 

Return the shape that was collided with during the last successful call to TestAgainstWorld.

Returns:
The shape collided with, or NULL if no sucessful attempt has occured. NOTE: If a successful attempt occurs, followed by an unsucessful attempt, the result from the previous sucessful attempt may be returned, rather then NULL.

float DigitalSpaces::DIPhysicsRay::GetDistanceFromLastTest (  ) 

Returns the distance of the collision during the last successul call to TestAgainstWorld.

Returns:
The distance the collision occured at, or 0.0 if no sucessful attempt has occured. NOTE: If a successful attempt occurs, followed by an unsucessful attempt, the result from the previous sucessful attempt may be returned, rather then 0.0.

void DigitalSpaces::DIPhysicsRay::GetPositionFromLastTest ( out_Vector3f position  ) 

Retreives the position of the collision during the last successul call to TestAgainstWorld.

Parameters:
[out] position The position the collision occured at. If no previous successful attempt has occured, the results are undefined. NOTE: If a successful attempt occurs, followed by an unsucessful attempt, the result from the previous sucessful attempt may be returned.

void DigitalSpaces::DIPhysicsRay::GetNormalFromLastTest ( out_Vector3f normal  ) 

Retreives the normal of the surface collided with during the last successul call to TestAgainstWorld.

Parameters:
[out] normal The normal of the surface the collision occured at. If no previous successful attempt has occured, the results are undefined. NOTE: If a successful attempt occurs, followed by an unsucessful attempt, the result from the previous sucessful attempt may be returned.


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