morse-simulator / morse

The Modular OpenRobots Simulation Engine
http://morse-simulator.github.io/
Other
356 stars 156 forks source link

Collision sensor's collision mesh does not scale correctly #642

Closed cdondrup closed 9 years ago

cdondrup commented 9 years ago

As requested on the mailing list, here the issue.

The collision sensor triggers too early, ~1m.

The suspected reason for this: In sensors.py a Cube mesh with SENSOR physics is created for the Collision sensor and then scaled to .02. However, the default size after creation is 1m and the scale command only seems to scale the visible mesh. The physics mesh used for the collision detection stays at 1m. Therefore even the unit test does not work properly for me: Running the file reports this:

{"timestamp": 1437058164.1657412, "collision": true, "objects": "dala"}

when both robots are in the start position. When removing the line where the property is set to only collide with obstacles, it is even more obvious:

{"timestamp": 1437058382.0976253, "collision": true, "objects": "Ground,dala"}

meaning that it is also colliding with the ground even though it is 20cm above it.

After a bit of digging through the blender pages I found this: http://www.tutorialsforblender3d.com/BGE_Python/Game_Logic/GameObject/GameObject_reinstancePhysicsMesh.html which is supposed to resize the physics mesh to the visible one but only for triangular meshes (not sure if still valid for latest blender version). See also: https://www.blender.org/manual/game_engine/physics/introduction.html#mesh-deformations

We are currently using morse 1.3.0 with 1a3475655b4f75c00b3082b5c533d445678312f9 being the latest commit and Blender 2.69 (sub 0) build date: 2014-03-22 build time: 21:47:21.

Since the unit test did not work, I am a bit suspicious that it might be a problem on my end. Has that been fixed in the latest version? Any other advice on how to deal with that?

adegroote commented 9 years ago

Can you confirm that it fixes your issue ?