Ogre mesh and setPhysicsLocation… (?)

I’m loading a ogre mesh with 6 geometry objects, when I check the centers of the bounding models they seem to be in the right place (see red markers in screen shot). But when I add a RigidBodyControl to each Geometry in the PhysicsSpace they are all centered at (0, 0, 0) and if I try to change the physical location the geometries move to a wrong position… Please tell me how I can align the physical location centers with the model bound centers…??? Thanks!

Do a physicsSpace.enableDebug(assetManager), then you’ll probably see what you do wrong.

Hi normen, debug mode is enabled and the collision shapes are in the right place but control.getPhysicsLocation() returns (0, 0, 0) for all objects…

By any chance did you export all the ogre meshes individually but they are all from the same scene?

wezrule said:
By any chance did you export all the ogre meshes individually but they are all from the same scene?

I'm exporting a single Model.mesh.xml that contains the 6 submeshes mentioned above. When loading it into jme3 I get a Node that contains the 6 Geometry objects from the mesh file...

Probably they are all in the middle, just the collision shape is off because the models are not centered in the model file…

I had a same problem.

try to export your blener model aggain and convert it to .j3o . Then you can add your Control at the sourcecode of your program. If you do this with the build in 3d-Editor, this will happen aggain.

normen said:
Probably they *are* all in the middle, just the collision shape is off because the models are not centered in the model file..


Sorry but what exactly do you mean, in the debug mode I can see that the collision shapes are correctly "wrapped" around the geometries (it is also visible in the screen shot) so how can they be all in the middle? And in case this is some bug in jme3 can't I just change the location values in the PhysicsSpace without moving the geometries or collision shapes, I think that would do it for me....

Imagine you create a box in blender, its in the middle. Then you move all vertices to the right, the object stays in the middle (coordinates 0/0/0) although the mesh is now off-center. The physics mesh generator accounts for that and creates a collision shape that is off-center with its center of mass at 0/0/0. This is not a bug, everything is working as expected.

I wanted to use setAngularVelocity() in the four curves of the model, which can never work when center of mass is somewhere far away…

So is there no workaround then? I somehow need angular velocity on the surface of the curves, so that it rotates around the corners (red markers in screenshot) ??

You need your geometries to keep their positions relative to the parent node. Try use the blender loader or export as a .scene

wezrule said:
You need your geometries to keep their positions relative to the parent node. Try use the blender loader or export as a .scene


I didn't know one could load .blend files directly from code, I think I'll try that...