Advertisement

undefined behavior of bullet objects.

Started by February 17, 2019 04:59 PM
15 comments, last by Uttam Kushwah 5 years, 8 months ago

Hello everyone i am trying to make some simpleton game but having trouble with bullet objects behavior.

in my game scene there is terrain shape for open world(which are nasty for now) and i am shooting some balls to check how terrain is doing. But some balls hit 

the terrain and some phase through so i don't know what to do or where exactly to dig.

 

you can see the problem here 

i know video quality is bad but bare it for now please i still newbie for uploading.

i guess you will get some clue what i am going through.

Thanks in advance.

 

Basic debugging starts with making a reproducible test case that you can run over and over and over again, and it fails each and every time. A second property of the testcase is that it is as simple as you can make it. Currently you have a very complicated shape and it fails. Does simpler shapes exist that have the same problem?

This pretty much rules out interactive trying. You can of course print the exact starting parameters of each ball, and then use one of those values to get it reproducible.

Once you have that, you can start digging. check the trajectory of the ball, check how it (not) interacts with the world. At exactly that point, find the part of the world it is supposed to hit, and find out why it doesn't. You may want to use a debugger, and step through the code statement by statement until you find the spot where a "false" is created where a "true" should have been created.

Since it is reproducible, you can endlessly try to catch the bug. If you moved past the point, or get confused what is happening, think what happened, and try again.

Advertisement

Thanks Alberth, 

So I need a solid test case which always fails, in that case my first ball always hit the plane but go through every other object that makes it(the case). Now I need to check the properties of the plane and the ball what making them interact to each other. By which i can find which thing having trouble the ball or other Non-planar object

I will try this. 

The problem is probably 'bullet tunneling'. Or in this case, if you are using bullet physics, you could call it 'bullet bullet tunneling'. :)

https://www.aorensoftware.com/blog/2011/06/01/when-bullets-move-too-fast/

Thanks lawnjelly, 

I have gone through the post you mentioned. 

But I am not sure that this is the problem with my simulation because that particular sphere also fails the raytest.  As I know raytest don't need time stamp to calculate the collision between the object and ray cause bullet and other physics engine checks collision when all the object are static at any instant. And also the size too is big. 

Although i will try to make it clear by reducing the velocity of the balls and then check it again and let you know

 

i tried decreasing down the ball's velocity it is not working.

2 hours ago, Uttam Kushwah said:

Thanks lawnjelly, 

I have gone through the post you mentioned. 

But I am not sure that this is the problem with my simulation because that particular sphere also fails the raytest.  As I know raytest don't need time stamp to calculate the collision between the object and ray cause bullet and other physics engine checks collision when all the object are static at any instant. And also the size too is big. 

Although i will try to make it clear by reducing the velocity of the balls and then check it again and let you know

 

 

Advertisement

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.

I guess than i have to do it by hard way? as Alberth suggested, So thanks for both of your replies and help?

 

Since you can log the initial position, velocity, etc. of each bullet and detect reliably which bullets tunnel through (they reach the boundaries of the scene), you can easily recover test cases from log files. Are you able to run scripted tests that launch one of the problem bullets without user input?

Omae Wa Mou Shindeiru

No they all are generated by user input. 

And I don't know how to do logging with bullet and scripting stuff too. But I am doing it by simply printing it to console , then close the application and find what happened - ?simple. 

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 ?

May be the ball hitting the back face of the triangle of terrain. If is it so then what should I do. 

Thanks for your attention. 

Note: I am a newbie but some day I'll learn how to do that fancy stuff. 

 

This topic is closed to new replies.

Advertisement