Crystal Space
Welcome, Guest. Please login or register.
November 19, 2017, 11:40:24 am

Login with username, password and session length
Search:     Advanced search
9081 Posts in 2051 Topics by 80446 Members
Latest Member: Jameswebb4996
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Project Development
| |-+  Feature Requests
| | |-+  SprCal3d plugin animation handling
« previous next »
Pages: [1] Print
Author Topic: SprCal3d plugin animation handling  (Read 7048 times)
Posts: 4

View Profile
« on: October 05, 2005, 11:57:20 am »

Granted, I'm not sure where this is better situated. It is more a feature request for an existing plugin.

Enough forewords, here it comes:

Playing around with SprCal3D I found it quite suitable for my character animation needs, but there is just one thing that is present in the Cal3D library which is passed on quite inadequately in the CrystalSpace SprCal3D plugin.

When using cal3dstate->SetAnimAction(action_name,blend_in,blend_out); where anim_name describes an animation with the "lock" state set (meaning the animation gets stopped at the last frame and won't be faded out) you can't get rid of the animation with any other means than calling sprcal3d->ClearAllAnims(); .

As a quick patch I did what is described in the following diff:
--- sprcal3d.cpp.orig   2005-10-05 12:14:32.000000000 +0200
+++ sprcal3d.cpp        2005-10-05 12:15:49.000000000 +0200
@@ -1756,6 +1756,14 @@
 bool csSpriteCal3DMeshObject::SetAnimAction(int idx, float delayIn,
                                                float delayOut)
+  if (idx == -1 && last_locked_anim != -1)
+  {
+     calModel.getMixer()->removeAction(last_locked_anim);
+     last_locked_anim = -1;
+     is_idling = false;
+     return true;
+  }
   if (idx < 0 || (size_t)idx >=factory->anims.Length() )
     return false;

To be short, it adds the option to do a cal3dsprite->SetAnimAction(-1,0.0,0.0); to remove the previosly set "locked" anim, though it is lacking any handling when there is more than one locked animation active (as it is with ClearAllAnims() as well).

Hope it helps.
Sr. Member
Posts: 295

View Profile
« Reply #1 on: October 06, 2005, 11:44:42 am »

I asked the author of sprcal3d about this, and he admitted that this feature of sprcal3d could stand improvement. He was curious, though, about a real-world game scenarios in which you would multiple locked animations being blended with non-locked animations.

I myself am not especially familiar with sprcal3d usage, but wouldn't it make more sense to introduce specific API into iSpriteCal3DState than to overload the meaning of SetAnimAction() in this fashion? Adding the ability to send -1 to SetAnimAction() seems unintuitive. A more explicit API might be better.
Posts: 4

View Profile
« Reply #2 on: October 06, 2005, 06:58:07 pm »

Of course, of course, that was more or less a hack to see if it would set things right... Some function like "StopAnimAction(cost char *name)" to (prematurely) stop the action animation being played.

One scenario for multiple locked animations would be to mix an animation of "sitting down" together with "reading something". Sitting just affects everything from the waitline down (pelvis and legs), reading manages the positioning of the arms. Combining both would result in a figure sitting somewhere at a table and reading.

Another tack is to reduce the idle animation simply to breathing or suchlike - and let the handling of certain "waiting" animations (like shuffling the feet or scratching oneself) being done by the surrounding game engine - in most cases it has its own ideas of how the creatures pass their time. Then, state animations may be done like "sitting_down" (letting the creature sit down and leave it at that, with locked=1) and "stop_sitting_down" (for gracefully standing up) or suchlike.

Next, one may blend a locked action animation into the figure to have it look a certain direction - have two animations like "head_turn_left" and "head_turn_right" where the head is turned 90 degrees to the left or right, respectively - and use the weight to adjust the actual angle. Using the delay values one can leave it to the animation subsystem to have the head turned in a graceful manner.

Hmmmnnn.... That warrants for another class of animations, let's call them "state animations", which may consist of a pair of one locked animation (transition from default to changed state) and one non-locked animation (transition back to default) with some function like "SetAnimState(char *state, bool ison, float delay)" to transform the figure into a given state (like sitting down, lying on a floor or such) and back to normal. Perhaps together with a blend weight...

Definitely need to think about that further.
« Last Edit: October 06, 2005, 07:32:44 pm by narron » Logged
Posts: 32

View Profile Email
« Reply #3 on: September 07, 2017, 09:21:47 am »

Franchement vous êtes formidable d'avoir fait un site pareil
voyance mail gratuit
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 8.208 seconds with 17 queries.