Bug Report with complete code to reproduce it

dumbo2007
Posts: 66
Joined: Sun Jan 30, 2011 8:46 pm

Bug Report with complete code to reproduce it

Post by dumbo2007 »

Long story short, I have 2 static planes. One at (0,0,0) and another at (0, 500, 0). I instantiate a btRayCastVehicle at (0, 10, 0), so above the lower plane. There is no other force or body in the world. The vehicle shoots straight up and keeps on going !! There is absolutely no reason for this to happen.

Reproduction code included.



If I replace the planes with btBoxShape, then this doesnt happen. But I want to use 2 planes above each other and parallel to each other.

If I place the planes closer to each other, say 50 units, then the vehicle (or in fact any other box), shoots up slower, but shoots up nevertheless. I cant understand how the position of 2 static planes can affect the position of a dynamic rigid body like a box when there are no other forces in the world at all, and no intervention from the user.
You do not have the required permissions to view the files attached to this post.
User avatar
jarno
Posts: 57
Joined: Tue Mar 16, 2010 1:42 am

Re: Bug Report with complete code to reproduce it

Post by jarno »

Planes have an inside and an outside, like they are infinitely thick. The normal of the plane points to the outside. So your vehicle is actually trapped deep inside the top plane, which is registered as a penetration which it then attempts to get out of.

Flip your top plane body so that it points downward instead of upward.

---JvdL---
dumbo2007
Posts: 66
Joined: Sun Jan 30, 2011 8:46 pm

Re: Bug Report with complete code to reproduce it

Post by dumbo2007 »

Thanks so much for the reply.

I am using planes to separate 2 simulation volumes which are actually far away from each other(2 different planets).

Code: Select all

       O        <- (rigid body on planet 2)
-------------------- <- (at 0, 500, 0)

           O              <- (rigid body on planet 1)
--------------------  <- (at 0,0,0)
So if planes have an inside and an outside, then I guess I cannot use planes to separate the 2 simulation volumes(one above the other) ? Since there will be rigid bodies on both sides of the plane, and 1 side will end up inside the plane no matter what.
User avatar
jarno
Posts: 57
Joined: Tue Mar 16, 2010 1:42 am

Re: Bug Report with complete code to reproduce it

Post by jarno »

You could do it by using two planes at (0,500,0), one facing each way. Then use collision masks to exclude the plane the rigid body is expected to be inside of.

Code: Select all

       O             <- (rigid body on planet 2)
----------/\-------- <- plane 2 at 0, 500, 0 facing up
-------\/----------- <- plane 1 at 0, 500, 0 facing down

           O         <- (rigid body on planet 1)
-------------------- <- (at 0,0,0)
Set collision masks to exclude rigid bodies on planet 2 from collisions with plane 1, and vice versa for planet 1 and plane 2. Also ensure that there is no collision detections between the planes. You could also put a bit of vertical separation between the two planes so that bodies from planet 1 can't touch those of planet 2 if they go ever so slightly through the planes.

---JvdL---
dumbo2007
Posts: 66
Joined: Sun Jan 30, 2011 8:46 pm

Re: Bug Report with complete code to reproduce it

Post by dumbo2007 »

Ok, if I am using collision masks to exclude collisions anyway, then why do I need plane 1 ?

I can just have 2 planes and for the objects on the lower plane, I can exclude them from colliding with the upper plane.
User avatar
jarno
Posts: 57
Joined: Tue Mar 16, 2010 1:42 am

Re: Bug Report with complete code to reproduce it

Post by jarno »

If the bodies from planet 1 are never going to come into contact with plane 1 (or you don't care if they do), then indeed you do not need that plane. I assumed you were using the planes to confine the objects within their zones.
dumbo2007
Posts: 66
Joined: Sun Jan 30, 2011 8:46 pm

Re: Bug Report with complete code to reproduce it

Post by dumbo2007 »

Yeah, I could use the planes to confine objects too. Maybe I ll do that :)