Jump to content
  • Advertisement
Uttam Kushwah

undefined behavior of bullet objects.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!