Scale node to a certain amount of units

Post those lines of code you feel like sharing or find what you require for your project here; or simply use them as tutorials.
Post Reply
Halan
Posts: 447
Joined: Tue Oct 04, 2005 8:17 pm
Location: Germany, Freak City
Contact:

Scale node to a certain amount of units

Post by Halan »

Heya,

I use this code to scale all my characters to a certain height an dont have to modfiy them in some modeler or so.
Guess the code explains itself. Would be a nice addition to ISceneNode

Code: Select all

setHeight(f32 newHeight, ISceneNode* node)
{
    vector3df extent = node->getBoundingBox().getExtent();

    if(extend.Y == 0)
          return; //Devide by Zero

    f32 scale = newHeight / extent.Y;
    node->setScale(vector3df(scale,scale,scale));
}
mfg,
Halan
Post Reply