Accessing relation ship between Rigid Body and Mesh ?

Software: Away3D 4.x

Aristophrenia, Newbie
Posted: 22 March 2012 12:31 PM   Total Posts: 2

Hi all,

Am currently adding a mesh to the AWPRigidBody and then adding this to the Rigid world, as per standard with a mouse listener on the mesh.

mesh.addEventListener(MouseEvent3D.CLICK, tipDomino);

And then in the resulting listener func does the deeds. Is there anyway of directly accessing the rigidbody in the physics from the mesh without traversing the entire world ?

for each (var body:AWPRigidBody in physicsWorld.nonStaticRigidBodies{
    
if (body.skin == Mesh(event.target)) body.applyCentralImpulse(impulse)
   

See it here

http://digitinteractive.com.au/domino/

controls.
wasd, mouse down to look, click dominos, fire with space bar, enter to reset.

   

John Brookes, Moderator
Posted: 22 March 2012 01:23 PM   Total Posts: 732   [ # 1 ]
yourMesh.extra {rb:yourRigidBody};
//...

private function tipDomino(e:MouseEvent3D):void 
{
 AWPRigidBody
(Mesh(e.target).extra.rb).applyCentralImpulse(impulse);
   

Aristophrenia, Newbie
Posted: 22 March 2012 08:30 PM   Total Posts: 2   [ # 2 ]

Thanks JohnBrookes,
I looked at the extra and felt there would be something more intuitive, such as declaring rigid bodies inside a dictionary object of the physics world relative to the meshes they are assigned. Will have to write my own.

This is perfect though. Thanks for your response.

Am amazed with the physics engine - really incredible.

Lets hope Adobe can sort their stuff out.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X