Hello to everyone,
I load two cubes from a single “.obj” file. That is my “scene”.
After loading them, I try to assign collision shapes to them. So, I write:
width = cube.maxX - cube.minX;
height = cube.maxY - cube.minY;
depth = cube.maxZ - cube.minZ;
shape = new AWPBoxShape(width, height, depth);
rigidBody = new AWPRigidBody(shape, cube, 1);
_physicsWorld.addRigidBody(rigidBody);
The above code results in this “scene”.
In order to position the meshes to the world space’s origin point (0, 0, 0) I use the “MeshHelper.recenter” function. After taking a look to this function’s source code, I saw that it uses the “Bounds” class in order to find the offset of the mesh’s vertices from the world space’s origin.
Using the “MeshHelper.recenter” function results in this “scene”.
Now, I want to reposition the meshes back to their original place. That is why, I need to know the aforementioned offset before “recentering” the meshes. So, I will, like the “MeshHelper.recenter” function, make use of the “Bounds” class to find that offset.
So, considering that need of mine for the calculation of the offset, I thought that it would be nice to have the “MeshHelper” (or any other utilities class) calculate it automatically.
And that is my request!:)