🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

undefined behavior of bullet objects.

Started by
15 comments, last by Uttam Kushwah 5 years, 3 months ago
23 minutes ago, Uttam Kushwah said:

But after messing around debug drawer I found the terrain triangles all have normals in the negative y axis.  Is this can be the reason behind the problem ?

Could well be. Try flipping the normals (i.e. if the normal is -0.1, 0.5, 0.3, flipped it would be 0.1, -0.5, -0.3) before sending them to bullet, or reverse the winding order of the triangles if bullet is calculating the normals (i.e. if triangle indices are 4, 3, 7 send 7, 3, 4).

Or try throwing the bullet from below the terrain, or flipping the orientation of the terrain as a test.

Advertisement

i tried the thing as you suggested hitting the balls from the downside, and guess what its persisted. Now i am thinking of making sandwich of two same terrain one above the other with very few distance between these two ( I know its dumb). But since it will give some thickness to the terrain  if first one miss the ball then second will throw it back lets hope , i am tranna do this because i will create three terrain with 150x150 so by doubling them it won't be that clumsy.

From your logs, extract the bullet's velocity vector (before and after) and the surface normal vector of all collision events.

  • If the velocity after the collision still points down, the collision has been detected and, as lawnjelly suggested, it's likely a problem with flipped normals (or more generally an incorrect collision response calculation). You can look at normals and angles to find the exact reason.
  • On the other hand if all bullets that collide with the terrain mesh bounced correctly up it would be strong evidence that the bullets that go through the terrain must be tunneling without colliding properly.

Omae Wa Mou Shindeiru

Ok i got a work to do , I will try everything that you all suggest here untill i get over this. 

Thanks again. 

Ok i got the problem figured out i.e. some part of the terrain is out of its own bounding box and that part tunnels other object even the giant one too. 

So how am I suppose to recalculate bounding box for the terrain a little hint please.

On 2/18/2019 at 6:07 PM, lawnjelly said:

If you are sure you can confirm it is not tunneling (you've tried continuous collision detection, you are sure of your stepping etc), then you will probably need to use detective work as Alberth suggests, I agree with the advice on using simple tests.

The ccd didn't work before because i messed up with the terrain bounding box problem, which is nothing but some minimum and maximum height issue. Now it's all working fine even with 1000m/s velocity for a sphere of radius 1m with following ccd configuration

body->setCcdMotionThreshold(1);
body->setCcdSweptSphereRadius(0.2f);

i didn't try bothering myself by changing the parameter of the post which i read before when i first tried ccd.Guess what i won't have to change it. 

One can tweak the parameter of above function according to their fast moving body dimension to get the correct result.(sorry if That is obvious)????????????

Thanks all of you.

This topic is closed to new replies.

Advertisement