Page 1 of 1

Resizing objects within code

Posted: Sat Aug 13, 2011 12:22 pm
by brick
I was wondering if there was any way to resize an imported mesh inside irrlicht code, e.g. if an object that I have imported was modeled too big and I would like to change its dimensions. Perhaps there is an answer to this in the tutorials, but I haven't found it.

Re: Resizing objects within code

Posted: Sat Aug 13, 2011 12:28 pm
by Radikalizm
Check out the IMeshManipulator class: http://irrlicht.sourceforge.net/docu/cl ... lator.html

Re: Resizing objects within code

Posted: Sat Aug 13, 2011 12:33 pm
by brick
Thanks a lot.

Re: Resizing objects within code

Posted: Sat Aug 13, 2011 2:05 pm
by mongoose7
You can just do node->setScale(...); as well.

Re: Resizing objects within code

Posted: Sat Aug 13, 2011 2:06 pm
by Radikalizm
mongoose7 wrote:You can just do node->setScale(...); as well.
This scales the node, not the mesh ;)
He specifically asked to scale the mesh, so in that case you need the mesh manipulator

Re: Resizing objects within code

Posted: Sat Aug 13, 2011 2:10 pm
by mongoose7
True, but it wasn't clear to me whether he wanted to resize the mesh or just show the object smaller. Also, I can't think of a reason why one would want to resize a mesh. I suppose you could build a large mesh out of smaller ones, but I don't think anyone does this. Well, there is MindCraft, but it uses internally generated objects.

Re: Resizing objects within code

Posted: Sat Aug 13, 2011 2:19 pm
by Radikalizm
mongoose7 wrote:True, but it wasn't clear to me whether he wanted to resize the mesh or just show the object smaller. Also, I can't think of a reason why one would want to resize a mesh. I suppose you could build a large mesh out of smaller ones, but I don't think anyone does this. Well, there is MindCraft, but it uses internally generated objects.
Say you have a mesh which has to be used by multiple nodes, and this mesh is somewhat too big (and for some reason you can't/won't edit it to make it smaller) and you want to scale it
In this situation it's easier to scale your mesh instead of scaling each node to get a correct size

Re: Resizing objects within code

Posted: Sat Aug 13, 2011 6:58 pm
by brick
Yeah, I was perhaps inaccurate in my original post. I didn't care what I was working with, I just wanted to make the object appear smaller on the scene. node->setScale() also does the job perfectly.