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 void ApplyImpulse (const csVector3 &impulse, size_t vertexIndex)=0
 Apply an impulse on the soft body at the position of the specified vertex.
virtual void DebugDraw (iView *rView)=0
 Draw the debug informations of this soft body.
virtual void GenerateBendingConstraints (size_t distance)=0
 Generate bending constraints between the vertices of this soft body.
virtual csVector3 GetLinearVelocity (size_t nodeIndex) const =0
 Generate cluster for the soft 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 SetAngularStiffness (float stiffness)=0
 Set the area/angular stiffness coefficient [0,1]. The default value is 1.0f.
virtual void SetDamping (float damping)=0
 Reset the collision flag to 0.
virtual void SetDrag (float drag)=0
 Set drag coefficient [0,+inf]. The default value is 0.0f.
virtual void SetLift (float lift)=0
 Set lift coefficient [0,+inf]. The default value is 0.0f.
virtual void SetLinearStiffness (float stiffness)=0
 Set the linear stiffness coefficient [0,1]. The default value is 1.0f.
virtual void SetLinearVelocity (size_t nodeIndex, const csVector3 &vel)=0
 The linear velocity of the given node.
virtual void SetPressure (float pressure)=0
 Set pressure coefficient [-inf,+inf]. The default value is 0.0f.
virtual void SetShapeMatching (bool match)=0
 Set rigid contacts hardness [0,1]. The default value is 1.0f.
virtual void SetShapeMatchThreshold (float matching)=0
 Set pose matching coefficient [0,1]. The default value is 0.0f.
virtual void SetVertexMass (float mass, size_t index)=0
 Set the mass of a node by index.
virtual void SetVolumeConversationCoefficient (float conversation)=0
 Set volume conversation coefficient [0,+inf]. The default value is 0.0f.
virtual void SetVolumeStiffness (float stiffness)=0
 Set the volume stiffness coefficient [0,1]. The default value is 1.0f.
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.

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::iSoftBody CS::Animation::iSoftBodyAnimationControl

Definition at line 657 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 void CS::Physics::iSoftBody::ApplyImpulse ( const csVector3 impulse,
size_t  vertexIndex 
) [pure virtual]

Apply an impulse on the soft body at the position of the specified vertex.

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.
vertexIndex The index of the vertex where the impulse is applied, in world coordinates.
See also:
CS::Physics::iPhysicalBody::ApplyImpulse()
virtual void CS::Physics::iSoftBody::DebugDraw ( iView rView  )  [pure virtual]

Draw the debug informations of this soft body.

This has to be called at each frame, and will add 2D lines on top of the rendered scene.

virtual void CS::Physics::iSoftBody::GenerateBendingConstraints ( size_t  distance  )  [pure virtual]

Generate bending constraints between the vertices of this soft body.

This can be used to make the body more rigid.

Parameters:
distance Maximum number of triangle edges that can exist between two vertices in order to have a constraint generated for this pair of vertices. Typical values are 2 or 3.
virtual csVector3 CS::Physics::iSoftBody::GetLinearVelocity ( size_t  nodeIndex  )  const [pure virtual]

Generate cluster for the soft body.

Count of all nodes The linear velocity of the given node

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::SetAngularStiffness ( float  stiffness  )  [pure virtual]

Set the area/angular stiffness coefficient [0,1]. The default value is 1.0f.

virtual void CS::Physics::iSoftBody::SetDamping ( float  damping  )  [pure virtual]

Reset the collision flag to 0.

Set true if use cluster vs convex handling for rigid vs soft collision detection. Get true if use cluster vs convex handling for rigid vs soft collision detection. Set true if use cluster vs cluster handling for soft vs soft collision detection. Get true if use cluster vs cluster handling for soft vs soft collision detection. Set soft vs rigid hardness [0,1] (cluster only). The default value is 0.1f. Set soft vs kinetic hardness [0,1] (cluster only). The default value is 1.0f. Set soft vs soft hardness [0,1] (cluster only). The default value is 0.5f. Set soft vs rigid impulse split [0,1] (cluster only). The default value is 0.5f. Set soft vs rigid impulse split [0,1] (cluster only). The default value is 0.5f. Set soft vs rigid impulse split [0,1] (cluster only). The default value is 0.5f. Set velocities correction factor (Baumgarte). Set damping coefficient [0,1]. The default value is 0.0f.

virtual void CS::Physics::iSoftBody::SetDrag ( float  drag  )  [pure virtual]

Set drag coefficient [0,+inf]. The default value is 0.0f.

virtual void CS::Physics::iSoftBody::SetLift ( float  lift  )  [pure virtual]

Set lift coefficient [0,+inf]. The default value is 0.0f.

virtual void CS::Physics::iSoftBody::SetLinearStiffness ( float  stiffness  )  [pure virtual]

Set the linear stiffness coefficient [0,1]. The default value is 1.0f.

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

The linear velocity of the given node.

virtual void CS::Physics::iSoftBody::SetPressure ( float  pressure  )  [pure virtual]

Set pressure coefficient [-inf,+inf]. The default value is 0.0f.

virtual void CS::Physics::iSoftBody::SetShapeMatching ( bool  match  )  [pure virtual]

Set rigid contacts hardness [0,1]. The default value is 1.0f.

Set kinetic contacts hardness [0,1]. The default value is 0.1f. Set soft contacts hardness [0,1]. The default value is 1.0f. Set anchors hardness [0,1]. The default value is 0.7f. Set velocities solver iterations. Set positions solver iterations. Set drift solver iterations. Set cluster solver iterations. Set true if use pose matching. The default value is false.

virtual void CS::Physics::iSoftBody::SetShapeMatchThreshold ( float  matching  )  [pure virtual]

Set pose matching coefficient [0,1]. The default value is 0.0f.

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::SetVolumeConversationCoefficient ( float  conversation  )  [pure virtual]

Set volume conversation coefficient [0,+inf]. The default value is 0.0f.

virtual void CS::Physics::iSoftBody::SetVolumeStiffness ( float  stiffness  )  [pure virtual]

Set the volume stiffness coefficient [0,1]. The default value is 1.0f.

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