Planes - Spheres - A few other quick questions.

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
heady
Posts: 4
Joined: Thu Dec 17, 2009 4:04 pm

Planes - Spheres - A few other quick questions.

Post by heady »

First, thanks for the engine and support - wow, really cool.

I am a complete beginner with a few of what should be--I hope--easy questions.

1. I place a plane in the scene and allow it to be controlled by the user so that it tilts in the direction of the arrow key pressed. Now, I place a sphere on the plane so that I can move it around by tilting the plane. But, I have two problems. First the sphere and plane do not make clean contact, the sphere passes through the plane even going all the way through and into oblivion if the plane is tilted too quickly or at too steep an angle. My second problem is that the sphere behaves something like a mixture between a steel marble and rubber hot air balloon! I want a steel marble. So, how do I get the collision between the plane and sphere to work correctly, and how do I create a steel marble instead of a rubber hot air marble?

2. Should I be using specific units in 3dsMax, if so which ones?

Thanks
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Planes - Spheres - A few other quick questions.

Post by Norbo »

Thanks for trying it out!

1) If you're currently changing the orientation directly, try instead changing the entity.angularVelocity property. If you change the orientation directly, it's like the entity is 'teleporting.' The actual movement speed of the object is zero, but its orientation changes. Objects sitting on the entity will not be able to respond to the motion correctly because there is no dynamic motion. The collision detection system will try to correct penetration as it happens, but this is a fairly 'gooey' procedure compared to the full rigid response you get when the velocities are correct for every object.

2) The only requirement is that the final sizes interpreted by your game are reasonable. Due to floating point precision issues (mostly in general-case collision detection), entities should not be excessively small, excessively large, nor excessively thin. Keeping entities' dimensions in a range of 0.5 to 10 units is very safe; the engine can handle far more usually, so you can try something and see if it works in a specific situation. Note that a sphere and box interacting have a different collision detection algorithm than a ConvexHull and MinkowskiSum. Sphere-box uses a special case which can support extremely large entities, while most type pairs (like ConvexHull-MinkowskiSum) use a general purpose convex-convex collision detection system which is more sensitive to floating point issues.
heady
Posts: 4
Joined: Thu Dec 17, 2009 4:04 pm

Re: Planes - Spheres - A few other quick questions.

Post by heady »

Thank you for the response and especially for the explanation of why it works. --it works!

The sphere responds almost perfectly. However, is there a way to increase its hardness so that it doesn't bounce as much?
Also, the sphere still doesn't ride on top of the plane, a portion of it is still inside the plane.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Planes - Spheres - A few other quick questions.

Post by Norbo »

What kind of bounce are you seeing? Without changing any settings, entities are set to perfectly rigid and non-bouncey by default.

Is a bit of the sphere always apparently stuck in the plane (could it be that the graphics are larger than the physical sphere)?

A little video might help me understand the behavior better.
heady
Posts: 4
Joined: Thu Dec 17, 2009 4:04 pm

Re: Planes - Spheres - A few other quick questions.

Post by heady »

I'm sorry, it's not bouncing at all. It was only the plane moving too quickly and either throwing the sphere or moving out from underneath it.

About the graphics, is there no specific unit like mm or inches that I must choose in 3dsMax so that I can have a 1:1 between my models and the environment?
I did bump up the size of the physical sphere and achieved the correct look, but it's at 1.8f and I don't want to experiment to find every value and I'm sure I
don't have too. --sorry for the flood of simple questions and again thank you.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Planes - Spheres - A few other quick questions.

Post by Norbo »

I can't say for certain that any given setting will produce exactly what you want; 3d programs can produce a variety of interesting results. BEPUphysics is 'unitless,' it just wants values in a relatively safe range (like I was talking about before with the floating point issues) once they're fully processed and in the game. The best bet is to experiment to identify a certain content path that produces consistent results (exporting it the same way every time) so that you can at least know how much you need to scale it.

A sphere entity with radius 1.8f will 'match' a graphical model of radius 1.84f units due to the collision margin (more information about the margin here: http://www.bepu-games.com/forums/viewto ... ?f=4&t=409). By default, the margin is .04f, that's why I added a bit. So while you may have to do a little guesswork initially to determine a workable, consistent content path, once you find it, you can calculate the sizes needed precisely.
heady
Posts: 4
Joined: Thu Dec 17, 2009 4:04 pm

Re: Planes - Spheres - A few other quick questions.

Post by heady »

Excellent, I'm having fun with bEPU, thanks again for the engine and support.
Post Reply