CollisionPolygon does not match any GeomNode

Hi all,

I’m using world.egg used in the example “walking on uneven terrain”, and using a CollisionLine to determine over which Polygon the actor steps each moment.

My problem is that when I perform getInto(), I get a CollisionPolygon that doesn’t match any Polygon in the geom nodes.
When debugging, I found that the CollisionPolygon belongs to the terrain group.

Checked the terrain group and found that it has 2008 CollisionSolids - I assume that they’re all CollisionPolygons.
When I checked the number of primitives in the terrain’s GeomNodes, I found that there are 2040.
Later I found that 32 of the 2008 CollisionPolygons are 4-vertices ones.

Any idea why I can’t match the resulted CollisionPolygon to any of the geometry’s polygons?
Or why does the number of CollisionPolygons doesn’t match the number of primitives?

Thanks in advance

It is never guaranteed to match up 100%. GeomNodes are meant to contain data optimised for rendering, whereas CollisionPolygons are meant for mathematical intersection tests. Both processes have different requirements on the format of the data, and as such, they may have undergone completely different optimisation procedures.

@rdb Thanks for your answer.

Can two CollisionPolygons have a common point?

I’ll explain:

In order to overcome the problem I described, I decided to create the CollisionPolygons programatically from the
Geometry primitives.

The terrain is composed of 2040 primitives (triangles) with 1089 distinct points. For each primitive I built a CollisionPolygon. I got 2040 CollisionPolygons but over 5800 distinct points.

When checking the data, I discovered that some of the points I used to create the CollisionPolygons were changed a little bit!!!

Any ideas why this happens?