CrystalSpace

Public API Reference

CS::Physics::Bullet::iSoftBody Struct Reference

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

#include <ivaria/bullet.h>

Inheritance diagram for CS::Physics::Bullet::iSoftBody:

List of all members.

Public Member Functions

virtual void AddForce (csVector3 force, size_t vertexIndex)=0
 Add a force at the given vertex of the body.
virtual void AddForce (csVector3 force)=0
 Add a force to the whole 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.
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 vertexIndex) const =0
 Get the linear velocity of the given vertex of the body.
virtual float GetMass () const =0
 Return the total mass of this body.
virtual float GetRigidity () const =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 () const =0
 Return the count of triangles of this soft body.
virtual size_t GetVertexCount () const =0
 Return the count of vertices of this soft body.
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 void RemoveAnchor (size_t vertexIndex)=0
 Remove the given anchor.
virtual void SetLinearVelocity (csVector3 velocity, size_t vertexIndex)=0
 Set the linear velocity of the given vertex of the body.
virtual void SetLinearVelocity (csVector3 velocity)=0
 Set the linear velocity of the whole body.
virtual void SetMass (float mass)=0
 Set the total mass of this body.
virtual void SetRigidity (float rigidity)=0
 Set the rigidity of this 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.

See also:
iRigidBody CS::Physics::Bullet::iRigidBody CS::Animation::iSoftBodyAnimationControl CS::Physics::Bullet::SoftBodyHelper

Definition at line 431 of file bullet.h.


Member Function Documentation

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

Add a force at the given vertex of the body.

virtual void CS::Physics::Bullet::iSoftBody::AddForce ( csVector3  force  )  [pure virtual]

Add a force to the whole body.

virtual void CS::Physics::Bullet::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::Bullet::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::Bullet::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::Bullet::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::Bullet::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::Bullet::iSoftBody::GetLinearVelocity ( size_t  vertexIndex  )  const [pure virtual]

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

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

Return the total mass of this body.

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

Get the rigidity of this body.

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

Return the triangle with the given index.

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

Return the count of triangles of this soft body.

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

Return the count of vertices of this soft body.

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

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

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

Return the position in world coordinates of the given vertex.

virtual void CS::Physics::Bullet::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::Bullet::iSoftBody::SetLinearVelocity ( csVector3  velocity,
size_t  vertexIndex 
) [pure virtual]

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

virtual void CS::Physics::Bullet::iSoftBody::SetLinearVelocity ( csVector3  velocity  )  [pure virtual]

Set the linear velocity of the whole body.

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

Set the total mass of this body.

virtual void CS::Physics::Bullet::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::Bullet::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