Jump to content
Sign in to follow this  
HeliJunkie

Need help with user animation

Recommended Posts

Can't get the animation working with the "animate" command.

If I define "source=clockMinute" all parts are turning fine...

if I define "source = user" and try "<object> animate ["Light",1];" ... nothing happens. No Error, no entry in .rpt... simply nothing...

Anyone has a hint for me ?

Ehhh.. yeah... "simulation=house"...

Got a user animation working in a model for testing some months (maybe Years :confused:) ago... but now i don't have an idea why it is not working.

Thanks for any help...

HeliJunkie

model.cfg:

 
 class Animations
 {
  class Light
  {
   type = "rotationY";
  [color=red]// source = "user";[/color]
   [color=seagreen]source = "clockMinute";[/color]
   sourceAddress = "loop";
   animPeriod = 2;
   selection="Lamps";
   axis="Lamps_Axis";
   memory=1;
   minValue=0;
   maxValue=1;
   angle0=0;
   angle1="rad 360";
  };
};

From config.cpp:

 
 class AnimationSources
 {
  class Light
  {
   source = user;
   animPeriod = 1;
   initPhase = 0;
  }; 
 };

Share this post


Link to post
Share on other sites

Well, I'm fairly new to this too, but have you tried just "rotation" as opposed to "rotationY"? I personally couldn't get rotationY to work for the radar on my carrier, and rotation does the same thing depending on how you have the axis set up.

But then never used clockMinute either... you sure you shouldn't have clockMinute in the config also, since its in the model.cfg? Maybe having "user" in one and "clockMinute" in the other is wrong?

+ what Myke said

Share this post


Link to post
Share on other sites

Thanks for your fast responses... but both hint's don't made it...

:rage: Argh.. my hair... I'm pulling it all off my head... ;-)

Any more ideas out there ???

Current Config Files:

model.cfg:

 
 class Animations
 {
  class Light
  {
   [color=seagreen]type = "rotation";[/color]
   [color=black]source = "user";[/color]
   sourceAddress = "loop";
   animPeriod = 2;
   selection="Lamps";
   axis="Lamps_Axis";
   memory=1;
   minValue=0;
   maxValue=1;
   angle0=0;
   angle1="rad 360";
  };
};

From config.cpp:

 
 class AnimationSources
 {
  class Light
  {
   [color=seagreen]source = "user";[/color]
   animPeriod = 1;
   initPhase = 0;
  }; 
 };

Edited by HeliJunkie

Share this post


Link to post
Share on other sites

Hmmm...you have different animPeriod settings in model.cfg and config.cpp, try with same value in both....although i have to admit it is just guesswork now.

Share this post


Link to post
Share on other sites
source in model.cfg should be "Light", also missing condition and statement in config.cpp, better have a look at the tutorial made by Gnat:

http://www.ofpec.com/tutorials/index.php?action=read&id=213

There isn't a source named "light" available. And animationsources don't have condition and statement settings, you mix it up with actions, buddy.

@HeliJunkie

did you tried with other animation values than 1, maybe 0.5? Although it shouldn't, it could be that the anim is played too fast and a change from 0 to 1 would mean a full rotation and therefor you "could" think it didn't worked while it indeed played the anim just too fast.

Share this post


Link to post
Share on other sites

I could be wrong, but the file model.cfg, next spring, should it not be labeled Light?

Or, instead of Light, in the file config.cpp should it not be marked clockMinute?

Indeed, normally, these two names are identical, right?

Furthermore, in your file config.cpp, do you have a class UserActions?

Sorry for my English, I use an automatic translator.

Edited by akio

Share this post


Link to post
Share on other sites

Can you explain to us what the animation is supposed to be/do? Like... does it run on its own or need a user to activate it? And what part isn't working, the animation or seeing the menu button for the animation in-game?

Share this post


Link to post
Share on other sites

First: THANKS for such a lot responses! :thumbsup:

@[GLT]Mike:

- changed "animPeriod" to use equal values

- tried a longer "animPeriod"

Both doesn't fix it.

@ALL:

No, I don't want a "UserAction". I simply want a animation (some turning lights) wich I can activate by script ('<object> animate ["Light",1]').

So I think I don't nees a "UserAction" class. Or ?

Maybe the Error is in the model ?

So, I uploaded the 2 configFiles and the Model (from O2/not binarized) here:

Download Policelight2.zip

Please... the model is very simple... it's conceptual work.

Here are the current file contents:

Model.cfg (Policelight2.cfg):

 
class CfgSkeletons
{
class PoliceLight2_Skeleton
{
 isDiscrete=0;
 skeletonInherit="";
 skeletonBones[]=
 {
  "Lamps","",
  "Top",""
 };
};
};
class CfgModels
{
class PoliceLight2
{
 sectionsInherit="";
 sections[]= {};
 skeletonName="PoliceLight2_Skeleton";

 class Animations
 {
  // This animation should turn the lights of the pole
  class Light
  {
   type = "rotation";
   angle0=0;
   // This should be for a "user" source => did not work
   source = "user";
   angle1="rad 360";
   // Use this for "clockMinute" source => works very well
   // source = "clockMinute";
   // angle1 = "rad 600*360";
   sourceAddress = "loop";
   animPeriod = 10;
   selection="Lamps";
   axis="Lamps_Axis";
   memory=1;
   minValue=0;
   maxValue=1;
  };

  // This animation should hide the "Top"-Plate of the pole...
  class HideTop
  {
   type = "hide";
   source = "user";
   animPeriod = 2;
   sourceAddress = "clamp";
   selection = "Top";
   memory = 1;
   minValue = 0;
   maxValue = 1;
   hideValue = 0.5;
  };
 };
}; 
}; 

And the config.cpp (in the model directory):

class CfgPatches
{
class HJ_PoliceLight2
{
 units[] = {"PoliceLight2"};
 weapons[] = {};
 requiredVersion = 1.00;
};
};
class CfgVehicles
{
class All{};
class Static : All{};
class Building : Static {};
class HouseBase : Building {};
class House : HouseBase {};


class PoliceLight2 : House
{
 model = "\PoliceLight2\PoliceLight2.p3d";
 scope = 2;
 displayName = "PoliceLight 2";
 animated = 1;
 simulation = "house";
 vehicleClass = "Misc"; 
 faction = "Default"; 

 class AnimationSources
 {
  class Light
  {
   source = "user";
   animPeriod = 10;
   initPhase = 0;
  }; 
  class HideTop
  {
   source = "user";  
   animPeriod = 2;
   initPhase = 0;
  }; 
 }; 

 class Reflectors  
 {
           class Light1 
  {
               color[] = {0.000000,0.000000,1.000000,1.000000 };
               ambient[] = {0.070000,0.070000,0.070000,1.000000 };
               position = "Light1";
               direction = "Light1_dir";
               hitpoint = "Light1";
               selection = "Light1";
               size = 1;
   brightness = 1;
           };

  class Light2 : Light1 
  {
      position = "Light2";
               direction = "Light2_dir";
   selection = "Light2";
  };

  class Light3 : Light1 
  {
      position = "Light3";
               direction = "Light3_dir";
   selection = "Light3";
  };

  class Light4 : Light1 
  {
      position = "Light4";
               direction = "Light4_dir";
   selection = "Light4";
  };
       };

 class eventhandlers
 {
  init="hint ""Policelight2 Init!"";";
 };
};
};

Edited by HeliJunkie
Added ";" mentioned in Post#11 by [GLT]Myke

Share this post


Link to post
Share on other sites
Myke;1762165']You have missing ; at the end of almost all class light.

Found them... you mean the light in the "Reflectors" class. Added them.

But didn't change anything.... :cryy:

Share this post


Link to post
Share on other sites

After a lot of hours testing my model and starting from scratch I (think I) found the reason! :yay:

The Lights (class Reflectors) stops the user animation (source = "user") !

And only the user animation!

If I remove the "class Reflectors" from the config.cpp file, all user animation work fine.

If I add the lights, the lights are working, but the animation doesn't.

If I then use (for example) the source="clockMinute" all animation and the lights do their job.

Can someone please confirm this ?

Try a rotation animation, its very easy to change to "clockMinute".

But use a large "angel1" value! (angel1 = "60*rad 360" => 1 turn per minute)

Or.. download my test Model ( LINK ) and play around with it.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×