About Store Forum Documentation Contact



Post Reply 
Animate a Chr
Author Message
Brendan Offline
Member

Post: #1
Animate a Chr
Alright I've been trying to figure out to animate a Game::Chr object.

I know i could use the player class or whatever the name is that they use in a lot of the tutorials, but I want to try doing it myself.

This is what i'm trying to use
Code:
/// I have a separate function that does the logic
// thats why i'm converting the chr to a pointer

Game::Chr *chr;
chr = &Chrs[0]  // the array is coming from loading the world



// this code is after code i have update the position. The position code works fine so I'm 100% sure that
// the chr works fine  this gets executed every frame your trying to walk

chr->cskel.clear();
chr->cskel.animate(L"data/anim/walk.anim", Time.time());
chr->cskel.updateMatrix    (MatrixIdentity); // update controlled skeleton animation matrixes
chr->cskel.updateVelocities();
chr->updateAnimation();


// the char gets rendered with Game::World.draw();
(This post was last modified: 01-03-2012 11:42 PM by Brendan.)
01-03-2012 11:38 PM
Find all posts by this user Quote this message in a reply
fatcoder Offline
Member

Post: #2
RE: Animate a Chr
Not exactly sure what you're asking as you didn't ask a question or point out a problem you are having. Anyway, did you take a look at the Amination tutorial, it gives a very simple and clear example of how to do it.
01-04-2012 04:13 AM
Find all posts by this user Quote this message in a reply
Brendan Offline
Member

Post: #3
RE: Animate a Chr
Oh my bad.. What I'm using doesn't work, its basicly code that i found from the animation tutorial and tried converting it to work for me. The animation tutorial just uses a cskel and renders it to a mesh with
Code:
Meshes("../data/obj/chr/skeleton/0.mesh")->draw(cskel);

I'm just trying to figure out a way to animate a Game::Chr
As you can see from the code in the first post a Game::Chr has a cskel and i tried using the same animation code as a plain cskel but it didn't work :(
01-04-2012 05:16 AM
Find all posts by this user Quote this message in a reply
Post Reply