Excluding Rigid Bodies From Calculation?

Software: Away3D 4.x

Alex Bogartz, Sr. Member
Posted: 13 October 2011 12:25 AM   Total Posts: 216

Is there a way to add rigid bodies but exclude them from the physics calculations if they are outside a specified area?  Can I turn them on and off?

   

Alex Bogartz, Sr. Member
Posted: 13 October 2011 12:38 AM   Total Posts: 216   [ # 1 ]

Just to flesh this out a little, I have a character and some platforms and some posts.  But if I make the grid very large, the performance lags quite a bit.  But really, I don’t need the posts to check each other, just the character.  And I don’t need the posts to check the platform since they won’t move.  All of them are static objects.  Can I set them all to just check for collisions with the character and not each other?

   

Yang Li, Administrator
Posted: 13 October 2011 01:45 AM   Total Posts: 80   [ # 2 ]

for the static objects, Of course they don’t check collision each other, it’s Internal rules. and Bullet use the fast AABB tree detection. Although, still not   recommended to create very large scene. maybe you can dynamically create/remove objects with character position.

   

Alex Bogartz, Sr. Member
Posted: 13 October 2011 01:48 AM   Total Posts: 216   [ # 3 ]

When I say the objects are static, I am setting the linear and angular factors as new Vector3D();

Is there a way to flag them as static objects?

   

Yang Li, Administrator
Posted: 13 October 2011 02:00 AM   Total Posts: 80   [ # 4 ]

set the mass to 0.

   

Alex Bogartz, Sr. Member
Posted: 13 October 2011 02:06 AM   Total Posts: 216   [ # 5 ]

Thanks, I set all of them to mass of 0, but I don’t see much difference.  Tomorrow, I am going to write up a scheme where each platform knows it’s neighbors, so I’ll disable all but the first platform and its neighbors, then when I step on a neighbor, clear the bodies and create a new group.  I’ll let you know how that performs!

   

Alex Bogartz, Sr. Member
Posted: 13 October 2011 05:21 PM   Total Posts: 216   [ # 6 ]

Ok, this worked very well. My basic strategy was to use the “extra” property of the skin to store all of the neighbors of each platform, as well as each platform’s posts.  The idea is that if you are on platform A, you’ll never hit a post from platform B.  But you could step on any of its neighbors.  So when I change platforms, I clear all the rigid bodies from the physics world, and rebuild them using the current platform, its neighbors, and its posts. Using this method, I now have around 120 platforms and 300 posts and I can still get good framerate.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X