Cyclone Cyclone: cyclone::Contact Class Reference

cyclone::Contact Class Reference

>Contact More...

#include <contacts.h>

Collaboration diagram for cyclone::Contact:

Collaboration graph
[legend]
List of all members.

Public Member Functions

void setBodyData (RigidBody *one, RigidBody *two, real friction, real restitution)
 Sets the data that doesn't normally depend on the position of the contact (i.e.

Public Attributes

RigidBodybody [2]
 Holds the bodies that are involved in the contact.
real friction
 Holds the lateral friction coefficient at the contact.
real restitution
 Holds the normal restitution coefficient at the contact.
Vector3 contactPoint
 Holds the position of the contact in world coordinates.
Vector3 contactNormal
 Holds the direction of the contact in world coordinates.
real penetration
 Holds the depth of penetration at the contact point.ContactIntro.

Protected Member Functions

void calculateInternals (real duration)
 Calculates internal data from state data.
void swapBodies ()
 Reverses the contact.ContactCalculateInternals.
void matchAwakeState ()
 Updates the awake state of rigid bodies that are taking place in the given contact.
void calculateDesiredDeltaVelocity (real duration)
 Calculates and sets the internal value for the desired delta velocity.
Vector3 calculateLocalVelocity (unsigned bodyIndex, real duration)
 Calculates and returns the velocity of the contact point on the given body.
void calculateContactBasis ()
 Calculates an orthonormal basis for the contact point, based on the primary friction direction (for anisotropic friction) or a random orientation (for isotropic friction).
void applyImpulse (const Vector3 &impulse, RigidBody *body, Vector3 *velocityChange, Vector3 *rotationChange)
 Applies an impulse to the given body, returning the change in velocities.
void applyVelocityChange (Vector3 velocityChange[2], Vector3 rotationChange[2])
 Performs an inertia-weighted impulse based resolution of this contact alone.
void applyPositionChange (Vector3 velocityChange[2], Vector3 rotationDirection[2], real rotationAmount[2], real penetration)
 Performs an inertia weighted penetration resolution of this contact alone.

Protected Attributes

Matrix3 contactToWorld
 A transform matrix that converts co-ordinates in the contact's frame of reference to world co-ordinates.
Vector3 contactVelocity
 Holds the closing velocity at the point of contact.
real desiredDeltaVelocity
 Holds the required change in velocity for this contact to be resolved.
Vector3 relativeContactPosition [2]
 Holds the world space position of the contact point relative to centre of each body.ContactInternalData.

Detailed Description

>Contact

Resolving a contact removes their interpenetration, and applies sufficient impulse to keep them apart. Colliding bodies may also rebound. Contacts can be used to represent positional joints, by making the contact constraint keep the bodies in their correct orientation. /<ContactIntro

It can be a good idea to create a contact object even when the contact isn't violated. Because resolving one contact can violate another, contacts that are close to being violated should be sent to the resolver; that way if one resolution moves the body, the contact may be violated, and can be resolved. If the contact is not violated, it will not be resolved, so you only loose a small amount of execution time.

The contact has no callable functions, it just holds the contact details. To resolve a set of contacts, use the contact resolver class. />ContactIntro


Member Function Documentation

void cyclone::Contact::applyImpulse const Vector3 impulse,
RigidBody body,
Vector3 velocityChange,
Vector3 rotationChange
[protected]
 

Applies an impulse to the given body, returning the change in velocities.

void cyclone::Contact::applyPositionChange Vector3  velocityChange[2],
Vector3  rotationDirection[2],
real  rotationAmount[2],
real  penetration
[protected]
 

Performs an inertia weighted penetration resolution of this contact alone.

void cyclone::Contact::applyVelocityChange Vector3  velocityChange[2],
Vector3  rotationChange[2]
[protected]
 

Performs an inertia-weighted impulse based resolution of this contact alone.

void cyclone::Contact::calculateContactBasis  )  [protected]
 

Calculates an orthonormal basis for the contact point, based on the primary friction direction (for anisotropic friction) or a random orientation (for isotropic friction).

void cyclone::Contact::calculateDesiredDeltaVelocity real  duration  )  [protected]
 

Calculates and sets the internal value for the desired delta velocity.

void cyclone::Contact::calculateInternals real  duration  )  [protected]
 

Calculates internal data from state data.

This is called before the resolution algorithm tries to do any resolution. It should never need to be called manually.

Vector3 cyclone::Contact::calculateLocalVelocity unsigned  bodyIndex,
real  duration
[protected]
 

Calculates and returns the velocity of the contact point on the given body.

void cyclone::Contact::matchAwakeState  )  [protected]
 

Updates the awake state of rigid bodies that are taking place in the given contact.

A body will be made awake if it is in contact with a body that is awake.

void cyclone::Contact::setBodyData RigidBody one,
RigidBody two,
real  friction,
real  restitution
 

Sets the data that doesn't normally depend on the position of the contact (i.e.

the bodies, and their material properties).

void cyclone::Contact::swapBodies  )  [protected]
 

Reverses the contact.ContactCalculateInternals.

This involves swapping the two rigid bodies and reversing the contact normal. The internal values should then be recalculated using calculateInternals (this is not done automatically).


Member Data Documentation

RigidBody* cyclone::Contact::body[2]
 

Holds the bodies that are involved in the contact.

The second of these can be NULL, for contacts with the scenery.

Vector3 cyclone::Contact::contactNormal
 

Holds the direction of the contact in world coordinates.

Vector3 cyclone::Contact::contactPoint
 

Holds the position of the contact in world coordinates.

Matrix3 cyclone::Contact::contactToWorld [protected]
 

A transform matrix that converts co-ordinates in the contact's frame of reference to world co-ordinates.

The columns of this matrix form an orthonormal set of vectors.

Vector3 cyclone::Contact::contactVelocity [protected]
 

Holds the closing velocity at the point of contact.

This is set when the calculateInternals function is run.

real cyclone::Contact::desiredDeltaVelocity [protected]
 

Holds the required change in velocity for this contact to be resolved.

real cyclone::Contact::friction
 

Holds the lateral friction coefficient at the contact.

real cyclone::Contact::penetration
 

Holds the depth of penetration at the contact point.ContactIntro.

If both bodies are specified then the contact point should be midway between the inter-penetrating points.

Vector3 cyclone::Contact::relativeContactPosition[2] [protected]
 

Holds the world space position of the contact point relative to centre of each body.ContactInternalData.

This is set when the calculateInternals function is run.

real cyclone::Contact::restitution
 

Holds the normal restitution coefficient at the contact.


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