CrystalSpace

Public API Reference

CS::Animation::iSoftBodyAnimationControl Struct Reference

Animation control for a genmesh animated by a CS::Physics::Bullet::iSoftBody. More...

#include <ivaria/softanim.h>

Inheritance diagram for CS::Animation::iSoftBodyAnimationControl:

List of all members.

Public Member Functions

virtual void CreateAnimatedMeshAnchor (CS::Mesh::iAnimatedMesh *animesh, iRigidBody *body, size_t bodyVertexIndex, size_t animeshVertexIndex=(size_t)~0)=0
 Create an anchor between the soft body and an animesh.
virtual size_t GetAnimatedMeshAnchorVertex (size_t bodyVertexIndex)=0
 Get the vertex of the animesh which is anchored to the given vertex of the soft body.
virtual
CS::Physics::Bullet::iSoftBody
GetSoftBody ()=0
 Get the soft body used to animate the genmesh.
virtual void RemoveAnimatedMeshAnchor (size_t bodyVertexIndex)=0
 Remove the given anchor.
virtual void SetSoftBody (CS::Physics::Bullet::iSoftBody *body, CS::Physics::Bullet::MeshDuplicationMode duplicationMode=CS::Physics::Bullet::MESH_DUPLICATION_NONE)=0
 Set the soft body to be used to animate the genmesh.

Detailed Description

Animation control for a genmesh animated by a CS::Physics::Bullet::iSoftBody.

This class will animate the vertices of the genmesh depending on the physical simulation of the soft body. It will also update automatically the position of the genmesh.

The soft body controlling the animation of the genmesh can also be attached precisely to a given vertex of an animesh. This allows to have the soft body following precisely the vertices of the animesh, even when it is deformed by the skinning and morphing processes.

Main creators of instances implementing this interface:

Main ways to get pointers to this interface:

Main users of this interface:

Definition at line 93 of file softanim.h.


Member Function Documentation

virtual void CS::Animation::iSoftBodyAnimationControl::CreateAnimatedMeshAnchor ( CS::Mesh::iAnimatedMesh animesh,
iRigidBody body,
size_t  bodyVertexIndex,
size_t  animeshVertexIndex = (size_t)~0 
) [pure virtual]

Create an anchor between the soft body and an animesh.

The position of the anchor will be updated accordingly when the vertex is moved by the skinning and morphing processes of the animesh.

This anchor is only effective if the vertex of the animesh is influenced by more than one bone or by some morph targets. If it is not the case then it is more efficient to simply use CS::Physics::Bullet::iSoftBody::AnchorVertex(size_t,iRigidBody*).

You have to provide a rigid body attached to the animesh as a main physical anchor point. The main way to do that is to use a CS::Animation::iSkeletonRagdollNode animation node.

Note also that you may anchor a same soft body to different animeshes, for example to create a cloth hold by several avatars.

Parameters:
animesh The CS::Mesh::iAnimatedMesh to attach the soft body to.
body The rigid body used as the main physical anchor point.
bodyVertexIndex The index of the vertex on the soft body which will be anchored.
animeshVertexIndex The index of the vertex on the animesh which will be anchored. If no values are provided then the system will compute the vertex on the animesh which is the closest to the given vertex of the soft body. This vertex can be queried afterwards through GetAnimatedMeshAnchorVertex().
virtual size_t CS::Animation::iSoftBodyAnimationControl::GetAnimatedMeshAnchorVertex ( size_t  bodyVertexIndex  )  [pure virtual]

Get the vertex of the animesh which is anchored to the given vertex of the soft body.

virtual CS::Physics::Bullet::iSoftBody* CS::Animation::iSoftBodyAnimationControl::GetSoftBody (  )  [pure virtual]

Get the soft body used to animate the genmesh.

virtual void CS::Animation::iSoftBodyAnimationControl::RemoveAnimatedMeshAnchor ( size_t  bodyVertexIndex  )  [pure virtual]

Remove the given anchor.

Warning:
This won't actually work, due to a limitation inside the Bullet library...
virtual void CS::Animation::iSoftBodyAnimationControl::SetSoftBody ( CS::Physics::Bullet::iSoftBody body,
CS::Physics::Bullet::MeshDuplicationMode  duplicationMode = CS::Physics::Bullet::MESH_DUPLICATION_NONE 
) [pure virtual]

Set the soft body to be used to animate the genmesh.

You can switch this soft body at any time, the animation of the genmesh will just be adapted to the new soft body.

Parameters:
body The soft body that will be used to animate this genmesh.
duplicationMode The duplication mode of the faces of the mesh. If the soft body has been created using CS::Physics::Bullet::iDynamicSystem::CreateSoftBody(iGeneralFactoryState*,const csOrthoTransform&,MeshDuplicationMode), then you should use the same parameter for both methods. A soft body created with CS::Physics::Bullet::iDynamicSystem::CreateCloth() should use a value of CS::Physics::Bullet::MESH_DUPLICATION_CONTIGUOUS.

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

Generated for Crystal Space 2.0 by doxygen 1.6.1