Get/Change Center of Geometry

I know it sounds ridiculous but I could not find a way to change the center of the geometry.

I have a model loaded from blender with a center out place problem and would like to fix it.

I cant just fix it on blender because there is too much objects this way, and also it will mess up with the object.

Any easy way to do it ?

Easy/right way:
Put it in a node and call setLocalTranslation on the geometry to move it.

Hard/bad way:
Change all of the points in the mesh.

Useful links:

Thanks pspeed , will try the node aprouch.

Though if you have many objects all with different centers then doing it in code wouldn’t be any easier than doing it in blender.

Actually, it’s surprisely easily to do this in blender, just select all objects and press ctrl+shift+alt+C, and center of mass option.
But… It mess up with the entire object because when I import it, all objects came with pos = 0,0,0 somehow. Its the asteroid object I am using from the other thread, it has some dependence from the original, and I just need its position in space.
If I had an move center of the mass function in the JM3 or if it imports the Blender correctly position it would fix my problem… Any tips ?

Just to add information to the thread, if you in blender press ctrl+a to enforce location, it will just back the center of mass to the odd position and keep the location in this case 0,0,0, so it didnt work as well … Also I tried to use the ogre export, same results …
Also one important curiosity I didnt understand, when you inport it on jM3, it shows correctly in the preview, even if the all positions and rotations are 0… How come ???

0/0/0 for the imported model will be where ever the world 0/0/0 in blender was when the model was made (the point you look at in a new blender file). If you move the whole model to 100/0/0 (world), it will have an offset of 100.

As for the import, it could be because the SDK 3.0 model import tool actually didn’t clear its cache after a model was imported.

Its strange, I close and reopened the jm3 with same results, dont looks to be a cache problem.
I can see in blender the objects have locations, but when it imports it has no location at all.
Maybe a bug on the importer ?

Also, when I open the ogre exported file, I can see the locations (offset) in the scene file :

node name=“Cube_cell.099”>
position x="-0.561625" z=“0.552325” y=“0.189273”/>
rotation qy=“0.000000” qw=“1.000000” qx=“0.000000” qz="-0.000000"/>
scale x=“1.000000” z=“1.000000” y=“1.000000”/>

entity name=“Mesh.449” friction_x=“1.0” ghost=“False” collisionPrim=“convex_hull” velocity_min=“0.0” lock_trans_y=“False” damping_rot=“0.10000000149011612” lock_rot_x=“False” lock_trans_x=“False” damping_trans=“0.03999999910593033” lock_trans_z=“False” friction_y=“1.0” anisotropic_friction=“False” inertia_tensor=“0.4000000059604645” friction_z=“1.0” physics_type=“RIGID_BODY” mass_radius=“1.0” lock_rot_z=“False” lock_rot_y=“False” actor=“True” velocity_max=“0.0” meshFile=“Mesh.449.mesh” mass=“0.01790318638086319”/>

But somehow its not imported …

Maybe you add physics controls which move them to their position…

Well, I was doing some debugging and found out something. Its actually a problem on my way to understand how the importer works, it has nodes and an tree of hierarchy inside it.
I found out that the correctly positions are in nodes, and I was ignoring those nodes…

So you traversed the scenegraph, took out all geometry, put it in your scene and forgot to mention all that when posting here you have a problem? :chimpanzee_facepalm:

I guess so :stuck_out_tongue:
Sorry for my noobish ! Still learning :slight_smile: