Home > Game Physics, Tutorials, game dev, gaming future, info > Spring constraint in Ageia Physics

Spring constraint in Ageia Physics

April 6th, 2008

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.

spring  constraint in ageia physics

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)

Buy us a coffee mug !

Table of contents for Joints in Director Ageia Physics

  1. Constraint descriptor
  2. Linear Joint in ageia physics
  3. Angular Joint in Director Ageia Physics
  4. Spring constraint in Ageia Physics
  • Share/Save/Bookmark

  1. No comments yet.
  1. No trackbacks yet.