CrystalSpace

Public API Reference

CS::Physics::iPhysicalBody Struct Reference

A base interface of physical bodies. More...

#include <ivaria/physics.h>

Inheritance diagram for CS::Physics::iPhysicalBody:

List of all members.

Public Member Functions

virtual void AddForce (const csVector3 &force)=0
 Add a force to the whole body.
virtual void ApplyImpulse (const csVector3 &impulse)=0
 Apply an impulse on the physical body.
virtual float GetDensity () const =0
 Get the density of the body.
virtual bool GetEnabled () const =0
 Get the enabled state of this body.
virtual float GetFriction () const =0
 Get the friction of this body.
virtual bool GetGravityEnabled () const =0
 Whether this object is affected by gravity.
virtual csVector3 GetLinearVelocity () const =0
 Get the linear velocity (translational velocity component).
virtual float GetMass () const =0
 Get the mass of this body.
virtual PhysicalObjectType GetPhysicalObjectType () const =0
 Get the type of this physical body.
virtual float GetVolume () const =0
 Return the volume of this body.
virtual bool IsDynamic () const =0
 Get whether this object is currently animated dynamically by the physical simulation, that is if it is either a dynamic actor, a soft body, or a dynamic rigid body.
virtual iRigidBodyQueryRigidBody ()=0
 Query the iRigidBody interface of this body.
virtual iSoftBodyQuerySoftBody ()=0
 Query the iSoftBody interface of this body.
virtual void SetDensity (float density)=0
 Set the density of this collider.
virtual void SetEnabled (bool enabled)=0
 Set the enabled state of this body.
virtual void SetFriction (float friction)=0
 Set the friction of this body.
virtual void SetGravityEnabled (bool enabled)=0
 Whether this object is affected by gravity.
virtual void SetLinearVelocity (const csVector3 &vel)=0
 Set the linear velocity (translational velocity component).
virtual void SetMass (float mass)=0
 Set the total mass of this body.

Detailed Description

A base interface of physical bodies.

iRigidBody and iSoftBody will be derived from this one.

Definition at line 136 of file physics.h.


Member Function Documentation

virtual void CS::Physics::iPhysicalBody::AddForce ( const csVector3 force  )  [pure virtual]

Add a force to the whole body.

virtual void CS::Physics::iPhysicalBody::ApplyImpulse ( const csVector3 impulse  )  [pure virtual]

Apply an impulse on the physical body.

The impulse is applied on the center of gravity of the body.

The impulse will be applied for the next simulation step. If you want a continuous impulse, then you need to apply it manually at each step.

Parameters:
impulse The impulse vector, in world coordinates.
See also:
CS::Physics::iRigidBody::ApplyImpulse(), CS::Physics::iSoftBody::ApplyImpulse()
virtual float CS::Physics::iPhysicalBody::GetDensity (  )  const [pure virtual]

Get the density of the body.

virtual bool CS::Physics::iPhysicalBody::GetEnabled (  )  const [pure virtual]

Get the enabled state of this body.

virtual float CS::Physics::iPhysicalBody::GetFriction (  )  const [pure virtual]

Get the friction of this body.

virtual bool CS::Physics::iPhysicalBody::GetGravityEnabled (  )  const [pure virtual]

Whether this object is affected by gravity.

virtual csVector3 CS::Physics::iPhysicalBody::GetLinearVelocity (  )  const [pure virtual]

Get the linear velocity (translational velocity component).

virtual float CS::Physics::iPhysicalBody::GetMass (  )  const [pure virtual]

Get the mass of this body.

virtual PhysicalObjectType CS::Physics::iPhysicalBody::GetPhysicalObjectType (  )  const [pure virtual]

Get the type of this physical body.

virtual float CS::Physics::iPhysicalBody::GetVolume (  )  const [pure virtual]

Return the volume of this body.

virtual bool CS::Physics::iPhysicalBody::IsDynamic (  )  const [pure virtual]

Get whether this object is currently animated dynamically by the physical simulation, that is if it is either a dynamic actor, a soft body, or a dynamic rigid body.

The only objects that are not dynamic are the rigid bodies that are either in static or kinematic state.

virtual iRigidBody* CS::Physics::iPhysicalBody::QueryRigidBody (  )  [pure virtual]

Query the iRigidBody interface of this body.

It returns NULL if the interface is not valid, ie GetPhysicalObjectType() is not CS::Physics::PHYSICAL_OBJECT_RIGIDBODY.

virtual iSoftBody* CS::Physics::iPhysicalBody::QuerySoftBody (  )  [pure virtual]

Query the iSoftBody interface of this body.

It returns NULL if the interface is not valid, ie GetPhysicalObjectType() is not CS::Physics::PHYSICAL_OBJECT_SOFTBODY.

virtual void CS::Physics::iPhysicalBody::SetDensity ( float  density  )  [pure virtual]

Set the density of this collider.

If the mass of the body was not defined then it will be computed from this. But iSoftBody must use SetMass instead.

You should be really careful when using densities because most of the game physics libraries do not work well when objects with large mass differences interact. It is safer to artificially keep the mass of moving objects in a safe range (from 1 to 100 kilogram for example).

virtual void CS::Physics::iPhysicalBody::SetEnabled ( bool  enabled  )  [pure virtual]

Set the enabled state of this body.

virtual void CS::Physics::iPhysicalBody::SetFriction ( float  friction  )  [pure virtual]

Set the friction of this body.

[0,1] for soft body.

virtual void CS::Physics::iPhysicalBody::SetGravityEnabled ( bool  enabled  )  [pure virtual]

Whether this object is affected by gravity.

virtual void CS::Physics::iPhysicalBody::SetLinearVelocity ( const csVector3 vel  )  [pure virtual]

Set the linear velocity (translational velocity component).

virtual void CS::Physics::iPhysicalBody::SetMass ( float  mass  )  [pure virtual]

Set the total mass of this body.


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

Generated for Crystal Space 2.1 by doxygen 1.6.1