About Store Forum Documentation Contact



Post Reply 
More animations / animation speed
Author Message
gamecreator Offline
Member

Post: #1
More animations / animation speed
Hi,

I tried to add another animation to sac in Character.h, like so

Quote:struct SkelAnimCache // Skeleton Animation Cache, these are the pointers to character default animations, you can replace them with custom ones, for example 'walk=cskel.getSkelAnim("custom walk.anim")'
{
SkelAnim
*fist_l , // left fist
*fist_r , // right fist
*stand , // stand still
*ready , // ready pose
*crouch , // crouch still
*turn_l , // turn left
*turn_r , // turn right
*walk , // walk forward
*run , // run forward
*crouch_f , // crouch and move forward
*crouch_l , // crouch and move left
*crouch_r , // crouch and move right
*strafe_wl, // strafe left walking
*strafe_wr, // strafe right walking
*strafe_l , // strafe left running
*strafe_r , // strafe right running
*dodge_l , // dodge left
*dodge_r , // dodge right
*floating, // float still
*myown; // I added this
Int head, neck, body,body_u, arm_ru,arm_lu, leg_lu,leg_ru,leg_ld,leg_rd, hand_l,hand_r, foot_l0,foot_r0; // indexes of skeleton bones found in 'cskel', -1=none
}sac; // not saved in SaveGame
but on recompiling the code, it said the following:
error C2039: 'myown' : is not a member of 'EE::Game::Chr::SkelAnimCache'

Can I add more animations to the existing sac struct? If so, how?

Also, I tried to change the animation speed. I was successfully able to change the movement speed simply by using
player.speed=1;
That worked no problem.

But when I tried the following
player.anim.speed=0;

I got this error
error C2248: 'EE::Game::Chr::anim' : cannot access protected member declared in class 'EE::Game::Chr'

How do I change the animation speed and why isn't it changed the same way as the movement speed?
12-03-2009 05:52 AM
Find all posts by this user Quote this message in a reply
Barthap Offline
Member

Post: #2
RE: More animations / animation speed
You cant edit engine header files. You must:
-Create a new code files in your project
-In new code file you must create class (here is chr):
Code:
class Chr : Game::Chr
{
   SkelAnim *myown;
   Chr() { myown=NULL; }
   void animate()
   {
     if(/*I wanna animate custom_anim*/)
       cskel.animate(myown,Tm.time(),1,true);
   }
   void create() {
      myown=&cskel.getSkelAnim("anim/own_anim.anim");
   }
}
(This post was last modified: 12-03-2009 10:53 AM by Barthap.)
12-03-2009 10:42 AM
Find all posts by this user Quote this message in a reply
gamecreator Offline
Member

Post: #3
RE: More animations / animation speed
Thank you Barthap. If anyone knows the answer to my second question (about how to change player.anim.speed) please let me know. Since I'm exporting the animation from Max, I'm sure I can just move the keyframes to make things faster or slower, so mostly I'm just curious.
(This post was last modified: 12-04-2009 06:16 AM by gamecreator.)
12-04-2009 06:12 AM
Find all posts by this user Quote this message in a reply
Barthap Offline
Member

Post: #4
RE: More animations / animation speed
You can change animation speed by clicking in Mesh Editor menu->main->Animation->main menu->load .anim file->Ctrl+L or in Animation menu click Change animation length. If length is higher, animation is slower.
12-04-2009 12:09 PM
Find all posts by this user Quote this message in a reply
Post Reply