Page 1 of 1

Models feet touching the floor etc

Posted: Mon Jul 09, 2007 5:39 pm
by kendric
Are most models that you load into irrlicht set up so that if you set their position, you are telling where their center goes? Or are you telling where the bottom of their feet or the bottom of the box that the model is for should stand.

One odd behaviour I noticed on a zombie model I found on the net for free, was that if I offset its position by a certain amount, its feet were now on the floor instead of it being in the air, but then when it died, it fell into the floor and you couldn't see it.

Whats the standerd way for deciding what to setPosition on a scene node that comes from a model, or is there no standard.

Thanks.

Posted: Mon Jul 09, 2007 6:46 pm
by omar shaaban
setpostion() sets the postion of the node so if the centre of the mesh is at his body and u set the postion(0,0,0)u would see half his body so...if u want to make him stand on the floor just set the centre of the mesh at his feet and that will do it! or tru to mesure the distance between the feet and the floor and set it like(0,19,0);

Posted: Mon Jul 09, 2007 7:07 pm
by Dorth
Not what he asked by a long shot.
Basically, there are 2 school of thinking.
First one goes with the center of the model in X,Z and lowest point on Y
It's usually the simplest and most useful. But there are some exception, especially in an environment where ground means little. In those case, a central point or NOTICEABLE point in the model is chosen. This is important. If yo always reference to pure center, you risk having your animation reacting weirdly with the physic of your game. Thus, you take for example the bellybutton of a character and choose to call it arbitrarily "center". If you keep this logic with all your models, you'll know that all animations will be AROUND that point. Again, if your project is grounded in anyway, this is more likely not the method you're looking for. But in a puzzle or floating game or space game, that might be perfect (in space, unless an extern force come affect you, all your movement are always around your mass center.)

My best advice is edit that model to correct that bug, if you can't do it and want to keep it, just note somewhere all it's behavior and adapt your code around ;)

Posted: Tue Jul 10, 2007 5:29 pm
by kendric
Ok thanks. I don't know much about model editing but I will see what I can do.