SetPosition

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
aflopera
Posts: 4
Joined: Sat May 07, 2005 10:27 am

SetPosition

Post by aflopera »

setPosition(vector3df(0,0,0)) place the center of the mesh at (0,0,0) ?
Guest

Post 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.
Guest

Post 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 ?
Pax
Posts: 12
Joined: Sat Apr 16, 2005 1:29 pm

Post 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.
Xico
Posts: 30
Joined: Sun Jun 05, 2005 5:08 pm
Location: Buenos Aires, Argentina
Contact:

Post 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.
don_Pedro
Posts: 84
Joined: Fri Jun 10, 2005 1:34 pm
Location: Poland
Contact:

Post 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
Post Reply