iRigidBody Struct Reference
This is the interface for a rigid body. More...
#include <ivaria/dynamics.h>

Public Member Functions | |
| virtual void | AddForce (const csVector3 &force)=0 |
| Add a force (world space) (active for one timestep). | |
| virtual void | AddForceAtPos (const csVector3 &force, const csVector3 &pos)=0 |
| Add a force (world space) at a specific position (world space) (active for one timestep). | |
| virtual void | AddForceAtRelPos (const csVector3 &force, const csVector3 &pos)=0 |
| Add a force (world space) at a specific position (local space) (active for one timestep). | |
| virtual void | AddRelForce (const csVector3 &force)=0 |
| Add a force (local space) (active for one timestep). | |
| virtual void | AddRelForceAtPos (const csVector3 &force, const csVector3 &pos)=0 |
| Add a force (local space) at a specific position (world space) (active for one timestep). | |
| virtual void | AddRelForceAtRelPos (const csVector3 &force, const csVector3 &pos)=0 |
| Add a force (local space) at a specific position (local space) (active for one timestep). | |
| virtual void | AddRelTorque (const csVector3 &force)=0 |
| Add a torque (local space) (active for one timestep). | |
| virtual void | AddTorque (const csVector3 &force)=0 |
| Add a torque (world space) (active for one timestep). | |
| virtual void | AdjustTotalMass (float targetmass)=0 |
| Set the total mass to targetmass, and adjust the properties (center of mass and matrix of inertia). | |
| virtual void | AttachCamera (iCamera *camera)=0 |
| Attach an iCamera to this body. | |
| virtual void | AttachCollider (iDynamicsSystemCollider *collider)=0 |
| Add a collider to this rigid body. | |
| virtual bool | AttachColliderBox (const csVector3 &size, const csOrthoTransform &trans, float friction, float density, float elasticity, float softness=0.01f)=0 |
| Add a box collider to this body. | |
| virtual bool | AttachColliderCapsule (float length, float radius, const csOrthoTransform &trans, float friction, float density, float elasticity, float softness=0.01f)=0 |
| Add a capsule collider to this body (oriented along it's Z axis). | |
| virtual bool | AttachColliderConvexMesh (iMeshWrapper *mesh, const csOrthoTransform &trans, float friction, float density, float elasticity, float softness=0.01f)=0 |
| Add a convex collider to this body. | |
| virtual bool | AttachColliderCylinder (float length, float radius, const csOrthoTransform &trans, float friction, float density, float elasticity, float softness=0.01f)=0 |
| Add a cylinder collider to this body (orientated along its local z axis). | |
| virtual bool | AttachColliderMesh (iMeshWrapper *mesh, const csOrthoTransform &trans, float friction, float density, float elasticity, float softness=0.01f)=0 |
| Add a concave collider to this body. | |
| virtual bool | AttachColliderPlane (const csPlane3 &plane, float friction, float density, float elasticity, float softness=0.01f)=0 |
| Add a plane collider to this body. | |
| virtual bool | AttachColliderSphere (float radius, const csVector3 &offset, float friction, float density, float elasticity, float softness=0.01f)=0 |
| Add a sphere collider to this body. | |
| virtual void | AttachLight (iLight *light)=0 |
| Attach an iLight to this body. | |
| virtual void | AttachMesh (iMeshWrapper *mesh)=0 |
| Attach an iMeshWrapper to this body. | |
| virtual void | Collision (iRigidBody *other, const csVector3 &pos, const csVector3 &normal, float depth)=0 |
| If there's a collision callback with this body, execute it. | |
| virtual void | DestroyCollider (iDynamicsSystemCollider *collider)=0 |
| Destroy body collider. | |
| virtual void | DestroyColliders ()=0 |
| Destroy body colliders. | |
| virtual bool | Disable (void)=0 |
| Temporarily ignore the body until something collides with it. | |
| virtual bool | Enable (void)=0 |
| Re-enable a body after calling Disable(), or after being auto disabled. | |
| virtual const csVector3 | GetAngularVelocity () const =0 |
| Get the angular velocity (rotation). | |
| virtual iCamera * | GetAttachedCamera ()=0 |
| Return the attached camera. | |
| virtual iLight * | GetAttachedLight ()=0 |
| Return the attached light. | |
| virtual iMeshWrapper * | GetAttachedMesh ()=0 |
| Return the attached MeshWrapper. | |
| virtual csVector3 | GetCenter ()=0 |
| Get the center of mass of this body. | |
| virtual csRef < iDynamicsSystemCollider > | GetCollider (unsigned int index)=0 |
| Get body collider by its index. | |
| virtual int | GetColliderCount ()=0 |
| Get the count of colliders of this body. | |
| virtual const csVector3 | GetForce () const =0 |
| Get total force (world space). | |
| virtual csRef< iBodyGroup > | GetGroup (void)=0 |
| Return which group a body belongs to. | |
| virtual csMatrix3 | GetInertia ()=0 |
| Get the matrix of inertia of this body. | |
| virtual const csVector3 | GetLinearVelocity () const =0 |
| Get the linear velocity (movement). | |
| virtual float | GetMass ()=0 |
| Get the total mass of this body. | |
| virtual const csMatrix3 | GetOrientation () const =0 |
| Get the orientation. | |
| virtual const csVector3 | GetPosition () const =0 |
| Get the position. | |
| virtual void | GetProperties (float *mass, csVector3 *center, csMatrix3 *inertia)=0 |
| Get the physic properties. 0 parameters are ignored. | |
| virtual const csVector3 | GetTorque () const =0 |
| Get total torque (world space). | |
| virtual const csOrthoTransform | GetTransform () const =0 |
| Get the transform. | |
| virtual bool | IsEnabled (void)=0 |
| Return true if a body is enabled. | |
| virtual bool | IsStatic (void)=0 |
| Tell whether a body has been made static or not. | |
| virtual bool | MakeDynamic (void)=0 |
| Make the body dynamic, ie the motion of the body is controlled by the dynamic simulation. | |
| virtual bool | MakeStatic (void)=0 |
| Make the body static, ie this body won't move anymore but dynamic objects will still collide with it. | |
| virtual iObject * | QueryObject (void)=0 |
| Return the underlying object. | |
| virtual void | SetAngularVelocity (const csVector3 &vel)=0 |
| Set the angular velocity (rotation). | |
| virtual void | SetCollisionCallback (iDynamicsCollisionCallback *cb)=0 |
| Set a callback to be executed when this body collides with another. | |
| virtual void | SetLinearVelocity (const csVector3 &vel)=0 |
| Set the linear velocity (movement). | |
| virtual void | SetMoveCallback (iDynamicsMoveCallback *cb)=0 |
| Set a callback to be executed when this body moves. | |
| virtual void | SetOrientation (const csMatrix3 &trans)=0 |
| Set the orientation. | |
| virtual void | SetPosition (const csVector3 &trans)=0 |
| Set the position. | |
| virtual void | SetProperties (float mass, const csVector3 ¢er, const csMatrix3 &inertia)=0 |
| Set the physic properties of this body. | |
| virtual void | SetTransform (const csOrthoTransform &trans)=0 |
| Set the transform. | |
| virtual void | Update ()=0 |
| Update transforms for mesh and/or bone. | |
Detailed Description
This is the interface for a rigid body.
It keeps all properties for the body. It can also be attached to a movable or a bone, to automatically update it.
Main creators of instances implementing this interface:
Main ways to get pointers to this interface:
Main users of this interface:
Definition at line 493 of file dynamics.h.
Member Function Documentation
| virtual void iRigidBody::AddForce | ( | const csVector3 & | force | ) | [pure virtual] |
Add a force (world space) (active for one timestep).
| virtual void iRigidBody::AddForceAtPos | ( | const csVector3 & | force, | |
| const csVector3 & | pos | |||
| ) | [pure virtual] |
Add a force (world space) at a specific position (world space) (active for one timestep).
| virtual void iRigidBody::AddForceAtRelPos | ( | const csVector3 & | force, | |
| const csVector3 & | pos | |||
| ) | [pure virtual] |
Add a force (world space) at a specific position (local space) (active for one timestep).
| virtual void iRigidBody::AddRelForce | ( | const csVector3 & | force | ) | [pure virtual] |
Add a force (local space) (active for one timestep).
| virtual void iRigidBody::AddRelForceAtPos | ( | const csVector3 & | force, | |
| const csVector3 & | pos | |||
| ) | [pure virtual] |
Add a force (local space) at a specific position (world space) (active for one timestep).
| virtual void iRigidBody::AddRelForceAtRelPos | ( | const csVector3 & | force, | |
| const csVector3 & | pos | |||
| ) | [pure virtual] |
Add a force (local space) at a specific position (local space) (active for one timestep).
| virtual void iRigidBody::AddRelTorque | ( | const csVector3 & | force | ) | [pure virtual] |
Add a torque (local space) (active for one timestep).
| virtual void iRigidBody::AddTorque | ( | const csVector3 & | force | ) | [pure virtual] |
Add a torque (world space) (active for one timestep).
| virtual void iRigidBody::AdjustTotalMass | ( | float | targetmass | ) | [pure virtual] |
Set the total mass to targetmass, and adjust the properties (center of mass and matrix of inertia).
The given mass will be used in place of the density of the colliders.
| virtual void iRigidBody::AttachCamera | ( | iCamera * | camera | ) | [pure virtual] |
Attach an iCamera to this body.
| virtual void iRigidBody::AttachCollider | ( | iDynamicsSystemCollider * | collider | ) | [pure virtual] |
Add a collider to this rigid body.
If you have set the collider transform before then it will be considered as relative to the attached body (but still if you will use colliders "GetTransform ()" it will be in the world coordinates. The collider becomes dynamic (which means that it will follow the rigid body).
| virtual bool iRigidBody::AttachColliderBox | ( | const csVector3 & | size, | |
| const csOrthoTransform & | trans, | |||
| float | friction, | |||
| float | density, | |||
| float | elasticity, | |||
| float | softness = 0.01f | |||
| ) | [pure virtual] |
Add a box collider to this body.
- Parameters:
-
size the box's dimensions trans a hard transform to apply to the mesh friction how much friction this body has, ranges from 0 (no friction) to infinity (perfect friction) density the density of this rigid body (used to calculate mass based on collider volume) elasticity the "bouncyness" of this object, from 0 (no bounce) to 1 (maximum bouncyness) softness how "squishy" this object is, in the range 0...1; small values (range of 0.00001 to 0.01) give reasonably stiff collision contacts, larger values are more "mushy"
| virtual bool iRigidBody::AttachColliderCapsule | ( | float | length, | |
| float | radius, | |||
| const csOrthoTransform & | trans, | |||
| float | friction, | |||
| float | density, | |||
| float | elasticity, | |||
| float | softness = 0.01f | |||
| ) | [pure virtual] |
Add a capsule collider to this body (oriented along it's Z axis).
A capsule is a cylinder with an halph-sphere at each end. It is less costly to compute collisions with a capsule than with a cylinder.
- Parameters:
-
length the capsule length along the axis (i.e. the distance between the two halph-sphere's centers) radius the capsule radius trans a hard transform to apply to the mesh friction how much friction this body has, ranges from 0 (no friction) to infinity (perfect friction) elasticity the "bouncyness" of this object, from 0 (no bounce) to 1 (maximum bouncyness) softness how "squishy" this object is, in the range 0...1; small values (range of 0.00001 to 0.01) give reasonably stiff collision contacts, larger values are more "mushy"
| virtual bool iRigidBody::AttachColliderConvexMesh | ( | iMeshWrapper * | mesh, | |
| const csOrthoTransform & | trans, | |||
| float | friction, | |||
| float | density, | |||
| float | elasticity, | |||
| float | softness = 0.01f | |||
| ) | [pure virtual] |
Add a convex collider to this body.
- Parameters:
-
mesh the mesh object which will act as collider. This must be a convex mesh. trans a hard transform to apply to the mesh friction how much friction this body has, ranges from 0 (no friction) to infinity (perfect friction) density the density of this rigid body (used to calculate mass based on collider volume) elasticity the "bouncyness" of this object, from 0 (no bounce) to 1 (maximum bouncyness) softness how "squishy" this object is, in the range 0...1; small values (range of 0.00001 to 0.01) give reasonably stiff collision contacts, larger values are more "mushy"
| virtual bool iRigidBody::AttachColliderCylinder | ( | float | length, | |
| float | radius, | |||
| const csOrthoTransform & | trans, | |||
| float | friction, | |||
| float | density, | |||
| float | elasticity, | |||
| float | softness = 0.01f | |||
| ) | [pure virtual] |
Add a cylinder collider to this body (orientated along its local z axis).
- Parameters:
-
length length of the cylinder radius radius of the cylinder trans a hard transform to apply to the mesh friction how much friction this body has, ranges from 0 (no friction) to infinity (perfect friction) density the density of this rigid body (used to calculate mass based on collider volume) elasticity the "bouncyness" of this object, from 0 (no bounce) to 1 (maximum bouncyness) softness how "squishy" this object is, in the range 0...1; small values (range of 0.00001 to 0.01) give reasonably stiff collision contacts, larger values are more "mushy"
| virtual bool iRigidBody::AttachColliderMesh | ( | iMeshWrapper * | mesh, | |
| const csOrthoTransform & | trans, | |||
| float | friction, | |||
| float | density, | |||
| float | elasticity, | |||
| float | softness = 0.01f | |||
| ) | [pure virtual] |
Add a concave collider to this body.
Concave colliders should be avoided because it is most costly to compute the collisions with them, and the simulation of their movement is less stable. It is safer to use a combination of convex colliders.
- Parameters:
-
mesh the mesh object which will act as collider trans a hard transform to apply to the mesh friction how much friction this body has, ranges from 0 (no friction) to infinity (perfect friction) density the density of this rigid body (used to calculate mass based on collider volume) elasticity the "bouncyness" of this object, from 0 (no bounce) to 1 (maximum bouncyness) softness how "squishy" this object is, in the range 0...1; small values (range of 0.00001 to 0.01) give reasonably stiff collision contacts, larger values are more "mushy"
| virtual bool iRigidBody::AttachColliderPlane | ( | const csPlane3 & | plane, | |
| float | friction, | |||
| float | density, | |||
| float | elasticity, | |||
| float | softness = 0.01f | |||
| ) | [pure virtual] |
Add a plane collider to this body.
- Parameters:
-
plane the plane which will act as collider friction how much friction this body has, ranges from 0 (no friction) to infinity (perfect friction) density the density of this rigid body (used to calculate mass based on collider volume) elasticity the "bouncyness" of this object, from 0 (no bounce) to 1 (maximum bouncyness) softness how "squishy" this object is, in the range 0...1; small values (range of 0.00001 to 0.01) give reasonably stiff collision contacts, larger values are more "mushy"
| virtual bool iRigidBody::AttachColliderSphere | ( | float | radius, | |
| const csVector3 & | offset, | |||
| float | friction, | |||
| float | density, | |||
| float | elasticity, | |||
| float | softness = 0.01f | |||
| ) | [pure virtual] |
Add a sphere collider to this body.
- Parameters:
-
radius radius of sphere offset position of sphere friction how much friction this body has, ranges from 0 (no friction) to infinity (perfect friction) density the density of this rigid body (used to calculate mass based on collider volume) elasticity the "bouncyness" of this object, from 0 (no bounce) to 1 (maximum bouncyness) softness how "squishy" this object is, in the range 0...1; small values (range of 0.00001 to 0.01) give reasonably stiff collision contacts, larger values are more "mushy"
| virtual void iRigidBody::AttachLight | ( | iLight * | light | ) | [pure virtual] |
Attach an iLight to this body.
| virtual void iRigidBody::AttachMesh | ( | iMeshWrapper * | mesh | ) | [pure virtual] |
Attach an iMeshWrapper to this body.
| virtual void iRigidBody::Collision | ( | iRigidBody * | other, | |
| const csVector3 & | pos, | |||
| const csVector3 & | normal, | |||
| float | depth | |||
| ) | [pure virtual] |
If there's a collision callback with this body, execute it.
- Parameters:
-
other The body that collided. pos is the position on which the collision occured. normal is the collision normal. depth is the penetration depth.
| virtual void iRigidBody::DestroyCollider | ( | iDynamicsSystemCollider * | collider | ) | [pure virtual] |
Destroy body collider.
| virtual void iRigidBody::DestroyColliders | ( | ) | [pure virtual] |
Destroy body colliders.
| virtual bool iRigidBody::Disable | ( | void | ) | [pure virtual] |
Temporarily ignore the body until something collides with it.
| virtual bool iRigidBody::Enable | ( | void | ) | [pure virtual] |
Re-enable a body after calling Disable(), or after being auto disabled.
| virtual const csVector3 iRigidBody::GetAngularVelocity | ( | ) | const [pure virtual] |
Get the angular velocity (rotation).
| virtual iCamera* iRigidBody::GetAttachedCamera | ( | ) | [pure virtual] |
Return the attached camera.
| virtual iLight* iRigidBody::GetAttachedLight | ( | ) | [pure virtual] |
Return the attached light.
| virtual iMeshWrapper* iRigidBody::GetAttachedMesh | ( | ) | [pure virtual] |
Return the attached MeshWrapper.
| virtual csVector3 iRigidBody::GetCenter | ( | ) | [pure virtual] |
Get the center of mass of this body.
| virtual csRef<iDynamicsSystemCollider> iRigidBody::GetCollider | ( | unsigned int | index | ) | [pure virtual] |
Get body collider by its index.
| virtual int iRigidBody::GetColliderCount | ( | ) | [pure virtual] |
Get the count of colliders of this body.
| virtual const csVector3 iRigidBody::GetForce | ( | ) | const [pure virtual] |
Get total force (world space).
| virtual csRef<iBodyGroup> iRigidBody::GetGroup | ( | void | ) | [pure virtual] |
Return which group a body belongs to.
| virtual csMatrix3 iRigidBody::GetInertia | ( | ) | [pure virtual] |
Get the matrix of inertia of this body.
| virtual const csVector3 iRigidBody::GetLinearVelocity | ( | ) | const [pure virtual] |
Get the linear velocity (movement).
| virtual float iRigidBody::GetMass | ( | ) | [pure virtual] |
Get the total mass of this body.
| virtual const csMatrix3 iRigidBody::GetOrientation | ( | ) | const [pure virtual] |
Get the orientation.
| virtual const csVector3 iRigidBody::GetPosition | ( | ) | const [pure virtual] |
Get the position.
| virtual void iRigidBody::GetProperties | ( | float * | mass, | |
| csVector3 * | center, | |||
| csMatrix3 * | inertia | |||
| ) | [pure virtual] |
Get the physic properties. 0 parameters are ignored.
| virtual const csVector3 iRigidBody::GetTorque | ( | ) | const [pure virtual] |
Get total torque (world space).
| virtual const csOrthoTransform iRigidBody::GetTransform | ( | ) | const [pure virtual] |
Get the transform.
| virtual bool iRigidBody::IsEnabled | ( | void | ) | [pure virtual] |
Return true if a body is enabled.
| virtual bool iRigidBody::IsStatic | ( | void | ) | [pure virtual] |
Tell whether a body has been made static or not.
- Warning:
- If you are using the Bullet plugin, a 'false' value returned by this method doesn't mean that the body is dynamic, it can also have been made kinematic through CS::Physics::Bullet::iRigidBody::MakeKinematic()
| virtual bool iRigidBody::MakeDynamic | ( | void | ) | [pure virtual] |
Make the body dynamic, ie the motion of the body is controlled by the dynamic simulation.
It will collide and react to any other bodies, whatever they are static or dynamic (or kinematic if you are using the bullet plugin).
| virtual bool iRigidBody::MakeStatic | ( | void | ) | [pure virtual] |
Make the body static, ie this body won't move anymore but dynamic objects will still collide with it.
This is especially useful for environmental objects.
| virtual iObject* iRigidBody::QueryObject | ( | void | ) | [pure virtual] |
Return the underlying object.
| virtual void iRigidBody::SetAngularVelocity | ( | const csVector3 & | vel | ) | [pure virtual] |
Set the angular velocity (rotation).
| virtual void iRigidBody::SetCollisionCallback | ( | iDynamicsCollisionCallback * | cb | ) | [pure virtual] |
Set a callback to be executed when this body collides with another.
If 0, no callback is executed.
| virtual void iRigidBody::SetLinearVelocity | ( | const csVector3 & | vel | ) | [pure virtual] |
Set the linear velocity (movement).
| virtual void iRigidBody::SetMoveCallback | ( | iDynamicsMoveCallback * | cb | ) | [pure virtual] |
Set a callback to be executed when this body moves.
If 0, no callback is executed.
| virtual void iRigidBody::SetOrientation | ( | const csMatrix3 & | trans | ) | [pure virtual] |
Set the orientation.
| virtual void iRigidBody::SetPosition | ( | const csVector3 & | trans | ) | [pure virtual] |
Set the position.
| virtual void iRigidBody::SetProperties | ( | float | mass, | |
| const csVector3 & | center, | |||
| const csMatrix3 & | inertia | |||
| ) | [pure virtual] |
Set the physic properties of this body.
The given mass will be used in place of the density of the colliders.
If you are using the 'bullet' plugin, it is safer to use AdjustTotalMass() to set only the mass and let the dynamic system compute the center of mass and matrix of inertia.
- Parameters:
-
mass The total mass of this body center The center of mass of this body inertia The matrix of inertia of this body
| virtual void iRigidBody::SetTransform | ( | const csOrthoTransform & | trans | ) | [pure virtual] |
Set the transform.
| virtual void iRigidBody::Update | ( | ) | [pure virtual] |
Update transforms for mesh and/or bone.
The documentation for this struct was generated from the following file:
- ivaria/dynamics.h
Generated for Crystal Space 2.1 by doxygen 1.6.1
