Page 1 of 1

Infinite plane collider

Posted: Sat Jun 02, 2018 1:38 pm
by ballyhoo
Hi there,

I'm new to BEPUphysics. I'm wondering is there a simple way to implement an infinite plane collider ? All what I need is a very simple plane Y=0, kinematic & facing upward. I can't find a clue in demos or documents...

Thanks a lot!

Re: Infinite plane collider

Posted: Sat Jun 02, 2018 9:28 pm
by Norbo
There is no true 'plane' collider, but it can be approximated by a large shape. For example, collisions with a triangle's face work pretty much the same as a plane. It would look something like this:

Code: Select all

var ground = new Entity(new TriangleShape(new Vector3(0, 0, 0), new Vector3(100000, 0, 0), new Vector3(0, 0, 100000)));
That said, there are some issues to watch out for- contacts with the edge of a large triangle will tend to be numerically unstable compared to the face contacts. So rather than making a big square out of two triangles, it'll tend to be better to have one bigger triangle translated to cover the same region.

Depending on what shapes are involved, using something like a large box might be preferable.

Certain queries won't work well with extremely large shapes, though. Vehicle wheel sweep tests might have some visible imprecision.

You might have better luck with using something like a Terrain composed of many triangles so that each one doesn't get so big as to cause numerical problems.

(The above is for v1. It sorta-kinda applies to v2 too, but v2 tends to use much more numerically stable implementations that allow bigger shapes.)

Re: Infinite plane collider

Posted: Sat Jun 02, 2018 10:32 pm
by ballyhoo
Thanks Norbo! Unfortunately I can't use a triangle that large. Actually I'm trying sAm_vdP's fixed-point port in Unity. As he claims "The value range of fixed point number is much more limited than float. As a result, the extent of the physics world should be limited to about 1000 on each axis", I will just use a big boxshape for ground if there's no easy way to make an ideal plane. :)