Spring constraint in Ageia Physics
What is a spring ?
A spring is a constraint similar to a joint , the only difference being that , in a spring constraint the constraint between 2 rigidbodies can be interchanged dynamically.
As in , during program execution one can change the constraint between rbA<->rbB to say rbA<->rbC .
Apart from this and the change in method to create a spring , no significant difference was found. Please refer Angular Joint for the diagram.

Syntax and usage:
createSpring( ConstraintDesc desc, symbol forceExertionMode , float restLength)
ConstraintDesc
Required. Reference to the constraint descriptor object.
forceexertionmode
Takes the following symbol values.
#kDuringCompression - Restoring force will be applied only when the actual length is less than the rest length between objectA and objectB.
#kDuringExpansion - Restoring force will be applied only when the actual length is more than the rest length between objectA and objectB.
#kBoth - Restoring force will be applied in both the above cases.
restlength
Required. Float value that specifies the rest length of the spring.
Example code :
-- Spring constraint Descriptor between two rigid bodies' b1 and b2. pocA = vector(6.0,0.0,0.0) pocB = vector(8.0,0.0,0.0) SpringDesc = ConstraintDesc("SpringDesc",b1,b2,pocA,pocB,500,1) --Create a spring which has expansion and compression with a rest length of 5. member("PhysicsWorld").createSpring(SpringDesc,#kboth,5.0)
Table of contents for Joints in Director Ageia Physics
- Constraint descriptor
- Linear Joint in ageia physics
- Angular Joint in Director Ageia Physics
- Spring constraint in Ageia Physics