Collision Detection : Resizing of models

Hello, I have a little problem.

A is a box model that has polygon detection in the egg file.
B is also a box but I setup a sphere collision in panda code.

When A and B have scale of 1.0 then everything is fine.
But when I set A.setSx(2.0) then the collision does not work right.
I also tried to setSx(2.0) on the collision node path for A but it gives the same affect, object B moves too far into A before detection.

The collision system does not work well in the presence of a non-uniform scale (that is, a scale different in X, Y, or Z). This is a known limitation with the system.

A simple workaround is to apply the scale to the vertices, with something like:


The flattenLight() call will adjust the vertices of A so that they are in the new scaled position, and then remove the scale, so that collisions will work once again. Note that flattenLight() is irreversible; you will have to reload the model (or counter-scale it with A.setSx(0.5)) if you want to restore it to a uniform box.