Ozmodian
Member
|
Request for animation tutorial
Esenthel Wrote:Post: #34RE: Question about Crowdfunding - Donation system
Hi Ozmodian smile
Could you please provide a few examples of the source code tutorials that you'd wish to have?
Hi All,
A while ago an item was opened for contributions for more tutorials (I don't see it any more). Esenthel asked me personally in a thread if i could think of any i needed (quoted above). I have thought of one and i thought i could do it myself but i am not able to.
I am working on a video tutorial i want to post about importing characters from various sites into EE. All the animation tutorials that are currently in the engine are using a direct reference to Game.ObjParamsPtr and CSkeleton. I am trying to use the Character class and with a rigged character that does not have the standard bones. I have looked through the object source files and i see the comment in Character.h below but nothing i do seems to work.
Code:
virtual void animate(); // this method animates the character skeleton using default animations, it consists only of following : 'cskel.clear().animate(stand).animate(walk)...', you can override this method and use it in 2 ways:
// 1) use default animations and modify them - "super::animate(); cskel.animate(custom animation)..."
// 2) use only custom animations - "cskel .clear (); cskel.animate(custom animation)..."
I would love a tutorial that is similar to the "World with Character" tutorial that does not use the Esenthel naming conventions for bones and adds and overrides standard animations with a custom animation (like walk for instance). I would be happy to put it together but i am totally stuck in that any character i upload i can animate fine in the current animation tutorials but not when using the Character class in EE.
I would love somebody to point me in the right direction.
Regards
(This post was last modified: 03-07-2014 08:03 AM by Ozmodian.)
|
|
03-07-2014 08:02 AM |
|
Esenthel
Administrator
|
RE: Request for animation tutorial
Hi,
I've closed the video tutorial contribution after I've made plenty of tutorials over here:
https://www.youtube.com/playlist?list=PL...A_kuHGz2cL
Did you check the Game.Chr sources?
Code:
void Chr::SkelAnimCache::set(CSkeleton &cskel, C ObjParamsPtr &obj)
{
// set default animations
fist_l =GetAnim(cskel, obj, "anim fist left");
fist_r =GetAnim(cskel, obj, "anim fist right");
all you need to do, is setup your own animations to the SkelAnimCache.
this is setup from Object params:
Code:
static SkelAnim* GetAnim(CSkeleton &cskel, C ObjParamsPtr &obj, CChar8 *anim)
{
if(obj)if(Param *param=obj->findParam(anim))switch(param->type)
{
case PARAM_ID : return cskel.findSkelAnim(param->value.id);
case PARAM_STR: return cskel.findSkelAnim(param->value.s );
}
return NULL;
}
So in practice you just drag and drop the animation elements, to object parameters of the character.
The OBJ_CHAR object class project element in Tutorials project has already setup everything. Just replace them with your own animations.
|
|
03-07-2014 08:09 AM |
|
Ozmodian
Member
|
RE: Request for animation tutorial
Hi Esenthel,
Thank you very much for the quick response. What you explained is the first thing that I tried. Below you will see my OBJ_CHR file.
I have tried many more things since then like manually calling
cskel.animate(UID, Time.time())
along with every possible combination of
cskel.clear();
cskel.updateMatrix (MatrixIdentity);
cskel.updateVelocities( );
updateAction ();
updateAnimation ();
updateController();
For reference, i have uploaded a simple version of the Character with World tutorial that replaces the default character with a leopard. If you look at it, you will see that no animations are called.
Thanks again for always providing excellent support.
|
|
03-07-2014 05:17 PM |
|
Esenthel
Administrator
|
RE: Request for animation tutorial
Hi,
The problem was that you've overridden the Object Class in the World Editor for the object.
You should set the class in the Object Editor (double click on the object, and select "Params" tab).
When you have overridden the class in the World, the class parameters aren't actually inherited. (this is sort of a limitation).
You could've noticed that those parameters were 50% transparent in the world object parameter list.
This means that they're not inherited, but are listed so you can easily "override them" by clicking on the checkbox.
The solution is to:
remove the class override from world object, and setup the class in object properties - I've tried it and worked.
I'll reduce the opacity even more, so it will be more noticeable.
|
|
03-11-2014 04:51 AM |
|
Ozmodian
Member
|
RE: Request for animation tutorial
Wow, i never would have though that was the issue. That fixed it completely. I can now finish my tutorial (finally!)
I really appreciate your help with this. I never would have figured that out.
|
|
03-11-2014 06:45 AM |
|