[solved] Scaling problem in Example SkeletalAnimation

mariobyb

17-03-2008 04:45:27

Hi

I have made a slight modification to the code in the Mogre-Samples\SkeletalAnimation example,
to load at random 3 different animated .mesh models instead of only the default robot model.

Now, multiple models are being initialized like this:
ent = sceneMgr.CreateEntity(name + i, name+".mesh");
sceneMgr.RootSceneNode.CreateChildSceneNode(new Vector3(-(row * 100), 0, (column * 50))).AttachObject(ent);


I try to scale the models like this:
ent.Scale(0.5f,0.5f,0.5f);


But that doesn't work. I think I need to attach the model to a node and scale that. Which I've already tryed whitout success.
Basically I'm struggling with the correct syntax for applying scaling.
Could somebody please show me the correct way to do this?
Thanks.

kerozcak

18-03-2008 22:15:05

Try this:

SceneManager mSceneManager = null;
Entity mEntity = null;
SceneNode mNode = null;

mSceneManager = sceneMgr;
mEntity = mSceneManager.CreateEntity(name + i, name+".mesh");
mNode = mSceneManager.RootSceneNode.CreateChildSceneNode(name + "Node", new Vector3(-(row * 100), 0, (column * 50)));
mNode.Scale(new Vector3(0.5f));
mNode.AttachObject(mEntity);

mariobyb

20-03-2008 14:50:25

Thank you Kerozcak. It works now! :)