[solved] how to set face normals?

madMAx4
Posts: 27
Joined: Fri Apr 20, 2007 7:29 pm
Location: Germany

[solved] how to set face normals?

Post by madMAx4 »

Hi,

I got GIMPACT collision to work properly.
but now i have a terrain mesh that lets objects fall through. so i turned the gravity vector from -10 to 10 an put a box below the terrain and everything works great.

now, how can i turn the terrain mesh that objects falling down don't fall through?
normally there are face normals defined, but i can't find such an attribute in btTriangleMesh and the others?

so how do you define them?
Last edited by madMAx4 on Sun Apr 22, 2007 8:14 pm, edited 1 time in total.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Post by Erwin Coumans »

You don't need to set facenormals using Bullet.

Please check the MovingConcaveDemo, for an example of GIMPACT.
For most cases, it is recommended to approximate moving concave objects with a convex or a grounp of convexes inside a compound shape.

The GIMPACT contribution is not well tested against latest Bullet mesh improvemens. This needs to be tested properly, but for a start, you might want to try if disabling 'quantization' helps.

Hope this helps,
Erwin
madMAx4
Posts: 27
Joined: Fri Apr 20, 2007 7:29 pm
Location: Germany

Post by madMAx4 »

GIMPACT collision works great.
i simplified the whole thing by using a box for the terrain too.

now, when the box falls down it collides not with the hull of the terrain box, but with the inner sides of the faces of the terrain box.
so i flipped all the face normals in blender and actually the box collides with the hull of the terrain now.

but the other side is that my grahpics engine (irrlicht) uses the same mesh file and therefore displays it wrong, with the face normals vice-versa.

then i compared the 2 different obj files, one with the original face normals and one with the flipped normals and the difference is the order in which the vertex indices of the faces are defined:

original face:

Code: Select all

f 1 2 3 4
and with flipped normals:

Code: Select all

f 1 4 3 2
so i have to flip the normals when importing the obj into bullet.
i think GLModel can do that for me, lets see.

thx so far

EDIT: GLMmodel::glmReverseWinding() does it ;)