[Solved]Animation - I am stuck..


26-10-2009 22:35:13

Hi again,

I've been trying for 1 day now, and cannot understand what I do wrong.
I've been reading the ogre manual, and tried my best.

What I am doing, is to keyframe a object (Node animation), and then I export with "Ogremax",
then in the Ogremax viewer the object moves as it should.

What i then do, is the following:
I have a function that's named "setupanimation":

private void setupanimations()

Entity myanimobj = sceneMgr.GetEntity("Box02");
Myanimstate = myanimobj.GetAnimationState("spin");

Myanimstate.Enabled = true;
Myanimstate.Loop = true;

Console.WriteLine("Myanim Length: " + Myanimstate.Length);
Console.WriteLine("Myanim Name:" + Myanimstate.AnimationName);
Console.WriteLine("Myanimstate.HasEnded:" + Myanimstate.HasEnded);

When I call it, and read the console, it says the correct time and everything, but it won't play..
I then use the "settime" thing, to try to move it forwards in time, but that does not work either.

Then in my "on every frame" function i have :


Also tried this because i found it in a topic:

Myanimstate.AddTime(evt.timeSinceLastFrame *0.1f);

still no luck. Any help would be greatly appreciated.


26-10-2009 23:35:40

Entity myanimobj = sceneMgr.GetEntity("Box02");
Myanimstate = myanimobj.GetAnimationState("spin");

Myanimstate = myDotSceneLoaderOgreMax.AnimationStates["spin"];


27-10-2009 05:06:42



27-10-2009 05:24:47

Oh, I though you use this one.


27-10-2009 09:01:39

I swapped the code with the one you point out.
I use the code provided, but get this:



27-10-2009 17:23:56

AnimationStates is not static. You have to use the one from the instance that loads the scene.


27-10-2009 18:11:48

thanks again, it works now!! :)

But there is one last problem, the camera is all messed up (FOV maybe?).

I'll post it here, but if i should move it to the dotscene topic, then let me know.

In 3dsmax:

In mogre:

the .scene:


27-10-2009 18:38:11

fixed the camera,
by using this code:

camera = sceneMgr.GetCamera("Camera01");
camera.NearClipDistance = 1;
camera.FarClipDistance = 0;

Vector3 campos = camera.Position;
camera.Position = campos;
camera.AutoAspectRatio = true;

it's the last part that did the trick :)