Wrong collision normals

cobolt_dink
Posts: 72
Joined: Fri Apr 04, 2008 6:07 pm

Wrong collision normals

Post by cobolt_dink »

I've never had good results trying to use the actual collision normals to change movements on objects. I using the contact buffering idea from Game Coding Complete 3 so that I can only track when two objects collide. Got the bright idea of adding all the normals in that contact and normalizing to get an overall normal for a given contact. I've been logging contacts and I will see an object hit a flat surface on the x axis and have Bullet report the collision was on z.

Sure this will go unanswered like my previous questions but what can I do about this? I have never been able to get reliable contact points with Bullet.
B_old
Posts: 79
Joined: Tue Sep 26, 2006 1:10 pm

Re: Wrong collision normals

Post by B_old »

What exactly do you mean, when you say you don't get reliable contact points?
I've been logging contacts and I will see an object hit a flat surface on the x axis and have Bullet report the collision was on z.
I'm not sure I understand. Did it land on the plane that the x and z axis span?
cobolt_dink
Posts: 72
Joined: Fri Apr 04, 2008 6:07 pm

Re: Wrong collision normals

Post by cobolt_dink »

Its a ball rolling around in a square frame with a floor tri mesh. It directly hit the side and was nowhere near the top. So the other thing that should have shown up is on the x axis. This has happened in more complicated levels where it hits a corner and 'slides' around it so could never be completely sure. But this time it was on a square edge and instead of rolling away it slide down the side. I can't just use the collision normal either as its not very realistic. Could have the ball rolling at an angle to the top wall but the generated normal will only be 0 0 1 which makes the ball shoot straight down instead of at an angle.

Another nifty thing is the ball is actually 0.5 over the tri mesh floor but will generate non y axis collisions in the middle of nowhere. :lol:
cobolt_dink
Posts: 72
Joined: Fri Apr 04, 2008 6:07 pm

Re: Wrong collision normals

Post by cobolt_dink »

To show what I'm talking about here is the data from a couple of contacts:

contact -0.131296 0.000000 -0.991343
heading -0.337895 0.000000 1.000000
new heading -0.337895 0.000000 -1.000000
position -23.825371 1.173419 64.515915

contact 1.000000 0.000000 0.000000
heading -0.337895 0.000000 -1.000000
new heading 0.337895 0.000000 -1.000000
position -23.903320 1.233779 62.998207

Now that first contact the ball hit square on the side (x axis) but the returned normal is on the z axis. Which causes the ball to 'slide'. Not until the next contact that it gets the right one for the ball to move away from the wall.