Model mesh scale issue

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
armakapo
Posts: 10
Joined: Wed Mar 14, 2012 12:54 am

Model mesh scale issue

Post by armakapo »

Hello, this is my first post on the forums, I've been using Irrlicht for a few weeks now. I have a question about a loaded mesh's scale. The thing is simple, I got a few models (b3d) from free sources, but their scale isn't good. For example, when I load a character's mesh and make a node, its height is about 50 units. I'll assume 1 unit = meter so, I have to scale it. There is no problem with that, using setScale(), but the thing is that all the children of that node are affected with that scale. Is there a built-in way to avoid that?
Thanks in advance.
REDDemon
Developer
Posts: 1044
Joined: Tue Aug 31, 2010 8:06 pm
Location: Genova (Italy)

Re: Model mesh scale issue

Post by REDDemon »

sure. Make that node a child too of another node so that old children now are brothers and it will no longer have additional nodes as children ;-)
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Model mesh scale issue

Post by Mel »

Or else, apply the inverse of the scale. If you are scaling the parent node to 1/50, scale the child node by 50 to compensate both scalings. Take into account that this represents no cost in the end, so you can have this setup always.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
CuteAlien
Admin
Posts: 9716
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Model mesh scale issue

Post by CuteAlien »

You can also try to use the meshmanipulator to scale the mesh before creating a node for it.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Model mesh scale issue

Post by Mel »

That was something i wasn't aware of. All i use the mesh manipulator for is to create meshes with tangent vertices. The mesh manipulator scales the position of the vertices, not the transformation matrix, right?
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Model mesh scale issue

Post by hybrid »

Yes, it's a fixed in-place transformation. But it will probably not work too good with animated meshes...
armakapo
Posts: 10
Joined: Wed Mar 14, 2012 12:54 am

Re: Model mesh scale issue

Post by armakapo »

Thanks a lot for your answers! I will try applying the inverse scale to the children. It will work for sure, but I don't think it will fix relative positions too. For example creating a flyCircleAnimator with X radius, and some center, relative to its parent. I'll have to multiply those values for the inverse scale too I guess. May I ask you, in your personal experience, do you have to scale the animated meshes you create? (for example with blender), or the units are 1:1 when you export and load your models?. Just was a bit curious on that, as I never created my own model yet.
Thank again for your help :]
Post Reply