Getting normals of colliders

How can I get the surface normal of a collider without a collision event?

It’s easy to do once I have a collision event, but when I first load an object for my level, I want to set its colliders’ collision masks depending on what their normals are.

Also, these objects will have parents which are scaled and rotated, so I didn’t want to read the normals out of the egg file.

Of course, one way is just to load all the objects and then collide with them once, but that seems silly.

So I tried just colliding with everything at load time to set the collide masks. This works alright except for the fact that normals are apparently just a vector put on the collider when it’s created (from the egg file I guess?), so if I scale the object, the colliders scale as well which give incorrect values.

The getSurfaceNormal function takes a node path as a reference frame, but this doesn’t seem to help. Using render just gives the normal vector with all of the scaling and rotating applied to it from the children. Using some node below render in the collider’s node path just strips off whatever scaling and rotation was done above that point.

Seems like I’ll be using the collider itself as the reference frame and then go through its parents one by one and modify the normal to properly reflect the effects of scaling (rotation is correct already).

This is all for polygon colliders by the way. I’m just trying to get the geometric normal of a polygon, not any special normal set in Blender.

So if there is just an easy way to look at a polygon collider’s final orientation and get the normal, that would be amazing.

I can get the points of the collision polygon…but they aren’t in world coordinates.

You can convert the points to world coordinates by using nodePath.getRelativePoint(). But I don’t understand the problem with the scaled normal that you were getting with the first attempt–if the scaling is a problem, why not just normalize it?