Page 1 of 1

Problem with scaleMesh() using IMeshManipulator

Posted: Wed Jan 30, 2008 7:49 pm
by christianclavet
Hi. I would like to really scale the mesh from the meshbuffer (So I can be calculated right for Creating occtrees and also right for the normals when using dynamic Lighting.

Searched the SDK and found command to do this.

Here is my implementation:

Model is the IAnimatedSceneNode
MeshModel is an IAnimatedMesh

Before doing this, I do a quick test to see if it's defined.

Code: Select all

IMeshManipulator * manip = Device->getSceneManager()->getMeshManipulator(); 
                     manip->scaleMesh(ModelMesh->getMesh(0),core::vector3df(4.0f,4.0f,4.0f));
                     manip->recalculateNormals(ModelMesh->getMesh(0),true);
                     Model->remove(); 
                     Model=Device->getSceneManager()->addAnimatedMeshSceneNode(ModelMesh);
The model is cleared and re-created using the meshbuffer but its not bigger. So it's not doing what I want. (Should be 4 times bigger, but it's not)

Posted: Thu Jan 31, 2008 9:08 am
by radubolovan

Posted: Thu Jan 31, 2008 10:52 am
by rogerborg
Christian is already doing ModelMesh->getMesh(0). I suspect this may be a format-specific issue. Christian, what's the model format you're using?

Posted: Thu Jan 31, 2008 1:07 pm
by radubolovan
You have to call

Code: Select all

((scene::SAnimatedMesh*)ModelMesh)->recalculateBoundingBox();
after scaling the mesh!
Try to enable the debug info for scene node and see the difference.

Posted: Fri Feb 01, 2008 7:15 am
by christianclavet
Hi.

Is there a limitation per mesh formats? Humm. Ok. Sorry. I didnt see that. Do you know where I could see for some info about this?

The problem I see, now, is when I activate the debug view on the mesh and it's it's scaled or rotated, the normals will look very weird.

I've read somewhere that this also could affect the collision response animator and the lighting of the model. (mostly the scaling of the model)

Thanks.