CrystalSpace

Public API Reference

CS::Physics::iSoftBody Struct Reference

A soft body is a physical body that can be deformed by the physical simulation. More...

#include <ivaria/physics.h>

Inheritance diagram for CS::Physics::iSoftBody:

List of all members.

Public Member Functions

virtual void AddForce (const csVector3 &force, size_t vertexIndex)=0
 Add a force at the given vertex of the body.
virtual void AnchorVertex (size_t vertexIndex, iAnchorAnimationControl *controller)=0
 Anchor the given vertex to the given controller.
virtual void AnchorVertex (size_t vertexIndex, iRigidBody *body)=0
 Anchor the given vertex to the given rigid body.
virtual void AnchorVertex (size_t vertexIndex)=0
 Anchor the given vertex to its current position. This vertex will no more move.
virtual float GetRigidity ()=0
 Get the rigidity of this body.
virtual csTriangle GetTriangle (size_t index) const =0
 Return the triangle with the given index.
virtual size_t GetTriangleCount ()=0
 Return the count of triangles of this soft body.
virtual size_t GetVertexCount ()=0
 Return the count of vertices of this soft body.
virtual float GetVertexMass (size_t index)=0
 Get the mass of a node by index.
virtual csVector3 GetVertexNormal (size_t index) const =0
 Return the normal vector in world coordinates for the given vertex.
virtual csVector3 GetVertexPosition (size_t index) const =0
 Return the position in world coordinates of the given vertex.
virtual const csVector3 GetWindVelocity () const =0
 Get the wind velocity of the whole body.
virtual void RemoveAnchor (size_t vertexIndex)=0
 Remove the given anchor.
virtual void SetLinearVelocity (const csVector3 &velocity, size_t vertexIndex)=0
 Set the linear velocity of the given vertex of the body.
virtual void SetLinearVelocity (const csVector3 &vel)=0
 Set the linear velocity (movement).
virtual void SetRigidity (float rigidity)=0
 Set the rigidity of this body.
virtual void SetVertexMass (float mass, size_t index)=0
 Set the mass of a node by index.
virtual void SetWindVelocity (const csVector3 &velocity)=0
 Set the wind velocity of the whole body.
virtual void UpdateAnchor (size_t vertexIndex, csVector3 &position)=0
 Update the position of the anchor of the given vertex relatively to the anchored rigid body.

Detailed Description

A soft body is a physical body that can be deformed by the physical simulation.

It can be used to simulate eg ropes, clothes or any soft volumetric object.

A soft body does not have a positional transform by itself, but the position of every vertex of the body can be queried through GetVertexPosition().

A soft body can neither be static or kinematic, it is always dynamic.

Main creators of instances implementing this interface:

Main ways to get pointers to this interface:

Main users of this interface:

See also:
CS::Physics::iRigidBody CS::Physics::Bullet2::iSoftBody

Definition at line 322 of file physics.h.


Member Function Documentation

virtual void CS::Physics::iSoftBody::AddForce ( const csVector3 force,
size_t  vertexIndex 
) [pure virtual]

Add a force at the given vertex of the body.

virtual void CS::Physics::iSoftBody::AnchorVertex ( size_t  vertexIndex,
iAnchorAnimationControl controller 
) [pure virtual]

Anchor the given vertex to the given controller.

The relative position of the vertex and the controller will remain constant.

virtual void CS::Physics::iSoftBody::AnchorVertex ( size_t  vertexIndex,
iRigidBody body 
) [pure virtual]

Anchor the given vertex to the given rigid body.

The relative position of the vertex and the body will remain constant.

virtual void CS::Physics::iSoftBody::AnchorVertex ( size_t  vertexIndex  )  [pure virtual]

Anchor the given vertex to its current position. This vertex will no more move.

virtual float CS::Physics::iSoftBody::GetRigidity (  )  [pure virtual]

Get the rigidity of this body.

virtual csTriangle CS::Physics::iSoftBody::GetTriangle ( size_t  index  )  const [pure virtual]

Return the triangle with the given index.

virtual size_t CS::Physics::iSoftBody::GetTriangleCount (  )  [pure virtual]

Return the count of triangles of this soft body.

virtual size_t CS::Physics::iSoftBody::GetVertexCount (  )  [pure virtual]

Return the count of vertices of this soft body.

virtual float CS::Physics::iSoftBody::GetVertexMass ( size_t  index  )  [pure virtual]

Get the mass of a node by index.

virtual csVector3 CS::Physics::iSoftBody::GetVertexNormal ( size_t  index  )  const [pure virtual]

Return the normal vector in world coordinates for the given vertex.

virtual csVector3 CS::Physics::iSoftBody::GetVertexPosition ( size_t  index  )  const [pure virtual]

Return the position in world coordinates of the given vertex.

virtual const csVector3 CS::Physics::iSoftBody::GetWindVelocity (  )  const [pure virtual]

Get the wind velocity of the whole body.

virtual void CS::Physics::iSoftBody::RemoveAnchor ( size_t  vertexIndex  )  [pure virtual]

Remove the given anchor.

This won't work if you anchored the vertex to a rigid body, due to a limitation in the Bullet library.

virtual void CS::Physics::iSoftBody::SetLinearVelocity ( const csVector3 velocity,
size_t  vertexIndex 
) [pure virtual]

Set the linear velocity of the given vertex of the body.

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

Set the linear velocity (movement).

virtual void CS::Physics::iSoftBody::SetRigidity ( float  rigidity  )  [pure virtual]

Set the rigidity of this body.

The value should be in the 0 to 1 range, with 0 meaning soft and 1 meaning rigid.

virtual void CS::Physics::iSoftBody::SetVertexMass ( float  mass,
size_t  index 
) [pure virtual]

Set the mass of a node by index.

virtual void CS::Physics::iSoftBody::SetWindVelocity ( const csVector3 velocity  )  [pure virtual]

Set the wind velocity of the whole body.

virtual void CS::Physics::iSoftBody::UpdateAnchor ( size_t  vertexIndex,
csVector3 position 
) [pure virtual]

Update the position of the anchor of the given vertex relatively to the anchored rigid body.

This can be used to have a finer control of the anchor position relatively to the rigid body.

This would work only if you called AnchorVertex(size_t,iRigidBody*) before. The position to be provided is in world coordinates.

Warning:
The stability of the simulation can be lost if you move the position too far from the previous position.
See also:
CS::Animation::iSoftBodyAnimationControl::CreateAnimatedMeshAnchor()

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

Generated for Crystal Space 2.1 by doxygen 1.6.1