Using AwayPhysics for a 2D project

Software: Other

Rhuno, Newbie
Posted: 10 December 2013 06:58 PM   Total Posts: 6

Hey all,

I was wondering if it is possible to use AwayPhysics for non-Away3d, 2d projects. I’ve used Box2D and Nape in the past, but thought I would look into this as well. Is this possible?

Thanks.

   

Mal Duffin, Newbie
Posted: 11 December 2013 07:20 PM   Total Posts: 14   [ # 1 ]

Hi Rhuno,

There are ways to restrict AwayPhysics ( / Bullet ) to just use 2 of the 3 axis.

One is to use AWPGeneric6DofConstraint ( with setLinearLimit and setAngularLimit to limit those axis ).  This will allow you for some movement in the axis you want to limit if required.

Another way ( probably more likely for what you want to achieve ) is to set the angularFactor and linearFactor on each rigid body that you add.  This will let you specify the x,y,z axis that get used for both rotation and movement.

aRB.linearFactor = new Vector3D ( 1, 1, 0 );  // only move in the x,y
aRB.angularFactor = new Vector3D ( 0, 0, 1 ); // only rotate in the z

Hope that helps…
Mal

   

Rhuno, Newbie
Posted: 11 December 2013 08:53 PM   Total Posts: 6   [ # 2 ]

Cool, I’ll give that a shot thanks. I did spend some time on the Bullet Physics board as well, but it seemed like there were a lot of mixed results with using it in 2d. But I’ll try it and see what happens.

   

Mal Duffin, Newbie
Posted: 18 January 2014 02:16 AM   Total Posts: 14   [ # 3 ]

Hey Rhuno,

Did you get AwayPhysics to work OK for you in 2D, or did you run into any problems?

Would be great to hear if it worked, to encourage more devs to use the physics ( more devs, more testing, hopefully more bug fixes / features )

   

Rhuno, Newbie
Posted: 18 January 2014 12:46 PM   Total Posts: 6   [ # 4 ]

Hey Mal,

I did not get this working; wasn’t able to wrap my head around removing the away3d stuff and keeping just the physics. All the examples I found were using 3d mesh objects and such. What I was looking to do was standard 2d Flash, but using AwayPhysics as opposed to box2d or nape.

Not a huge deal; I was more or less just curious if it could work.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X