Page 1 of 1

SetPosition

Posted: Mon May 30, 2005 10:25 am
by aflopera
setPosition(vector3df(0,0,0)) place the center of the mesh at (0,0,0) ?

Posted: Mon May 30, 2005 1:17 pm
by Guest
setPosition moves the scenenode so its origin (which may be different from the center of the mesh) is at the specified postion.

But it's relative to the parent object. If you set the parent of an object, the parent's position and rotation are applied to it to get the actual absolute position.

Posted: Tue May 31, 2005 11:36 am
by Guest
thanks, but how can I position the center of a mesh at (0,0,0)?
My problem is: I load a cube(.X format) and I want to position the center of the cube at (0,0,0)?

another problem is how to get dimensions of the cube ?

Posted: Tue May 31, 2005 12:11 pm
by Pax
Hi guest, for your 1st question, i guess it has to be on your modeler. in LW you center your object on the grid. On Xsi you tag vertices and then Transform - Move center to vertices.

For your 2nd question, so far I've just been working by trial and error :roll: , but getting the position of the camera at the start of your object and then at the end and displaying the result of a substraction might work. I'm sure there's another method, but then again, don't know.

Posted: Mon Jun 13, 2005 4:47 am
by Xico
For the 2nd question: not sure, but I think you can try getting the size of the bounding box or something like that.

Posted: Mon Jun 13, 2005 6:23 am
by don_Pedro
I would try something like this

Code: Select all

aabbox3df box = scene_node_name->getBoundingBox();
vector3df center = (box.MaxEdge + box.MinEdge)/2;
then just substract center from actual cube position, it should work, I didn't checked :D