Relative Vector.

Software: Away3D 4.x

chandings, Newbie
Posted: 27 September 2012 10:23 AM   Total Posts: 6

Hi all,

I am sure what i am asking is a very silly question but if I could get a quick answer it would be great.

I have a rigid body (body) in my away physics world. now i want to apply a central force to it in the y direction relative to the body.

var force:Vector3D = new Vector3D(0,100,0)
body.applyCentralForce(force);//This would work fine if body has no rotation
//But i need to get a method to transform a vector from global to local and
//local to global 

Please help me how to do it.

   

macaan, Newbie
Posted: 27 September 2012 01:17 PM   Total Posts: 30   [ # 1 ]

you can use the inverseSceneTransform object to translate from world to model space.

in your case something like

forceLocal = bodyMesh.inverseSceneTransform.transformVector(force);

   

John Brookes, Moderator
Posted: 27 September 2012 01:52 PM   Total Posts: 732   [ # 2 ]

You can also use up,front and right from the rigidbody.

var f:Vector3D = body.up;
f.scaleBy(100);
body.applyCentralForce(f);

   

chandings, Newbie
Posted: 27 September 2012 04:44 PM   Total Posts: 6   [ # 3 ]

hey Thanks!

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X