collisionEntry.getSurfaceNormal

HI folks,

Given: Box: static, into Object
Sphere: moving and under joystick control

after colliding them for some time the surface normal gets “stuck”

the collision entry point is still updating but even after changing the box’s sids to collide the ball into, the surface normal points completly wrong

what could be happening

zjanks
Martin

Does it work if you construct a box using six polygons, instead of using a CollisionBox?

David

I’ll try it tomorow

MArtin

So, I have built a simple .egg cube:
everything is working as expected My Ball can collide with it for ever and ever and the surfacenormal is normal.

but as soon as I go back to the game environment --built in Blender and chikened to egg-- My Ball,after hitting the box there for some events throws a wrong surfaceNormal.

Martin

When you say “wrong”, do you mean it is a normal for a different face, or do you mean it is not a normal for any of the faces?

David

It’s a normal for a different face. The box in the environment is a cube one face on the x,y Plane and one other on the x,z plane. I bounce the sphere for some time on the x,z plane and suddenly I get the normal for the upper x,y Plane.

At the moment I’m checking the .egg for faults.

By the way does anybody know how the magnitude of the normal is computed?

David, thank you.

Martin

Use getLength() to get the vector magnitude.

Well, are you certain that the sphere didn’t intersect with the upper x,y face? The collision that you’re reporting might well indicate a collision with that face. You can check entry.getInto() to return the particular CollisionSolid that it detected a collision with; check to see whether it is the CollisionPolygon that corresponds to the upper face.

Note that a certain amount of error in collision detection is normal. It is designed to be fast and reasonably accurate, but it cannot be 100% accurate. This means you may occasionally detect collisions where there should have been none; or you may occasionally miss collisions where they should have been detected.

David