CodeRecipe( );

one stop for all game coders..

Follow us on Twitter
Home
AxisAffinity property Print E-mail
User Rating: / 1
PoorBest 
Written by CR Team   
Tuesday, 25 August 2009 16:50


The rigid body I created in Director sometimes tends to curve when a force if applied to it. i expect it to travel in the direction of force in a straight line. How do I fix it ?

Director 11.5 introduced a rigidbody property called the axisAffinity. All rigid bodies by default seem to have a tendency to curve towards a random axis . To avoid this one can make use of this property.physics

AxisAffinity is a Boolean value. the default value is false. That means rigid bodies may tend to curve ( Note that this visible only when small force is applied on the rigid body ).

Set the axisAffinity property of a rigid body to false only if required, say a cue ball which has to travel the right path.

Code snippet
1
2
3
4
5
6
--Lingo Syntax 
cueBallRB = member("PhysicsWorld").getRigidBody("rb_cueball")
put cueBallRB.axisAffinity --would return true by default
objRB.axisAffinity = false
--You are specifying that the cue ball should not have
--any axis affinity

Setting this property to false for all rigid body can increase computation and hence result in performance degradation

The cool thing would be to simulate a corner curve kick in footbal !

Example: Hold a special key and the user is allowed to curve kick,i.e axisaffinity set to false on the footbal

A  normal kick with axisAffinity set to true Cool ...

 

 


 

CR Login

CodeRecipe Store

Twitter Feed

CR :) >>: RT @indiegamescom: Student game dev competition Dare to be Digital now accepting applicants http://t.co/Hf1phWJG