Jump to content
Sign in to follow this  
abs

Rotation Anim Based on Time

Recommended Posts

Hi all,

I am trying to make my solar system feel more "alive". In order to do that, I have started animating my planets. It's a simple anim that rotates the model in place. I have two components to it:

1. The planet itself.

2. A cloud layer.

Right now, they both turn at the same speed, despite the fact that the animPeriod is half the time for the clouds layer. Does this have to do with the fact that the source is "time"?

model.cfg

class CfgSkeletons {
   class Default {
       isDiscrete = 1;
       skeletonInherit = "";
       skeletonBones[] = {};
   };


   class STA3_Earth_skeleton : Default {
       isDiscrete=1;
       skeletonInherit="";
       skeletonBones[]= {
           "planet","", 
           "clouds","",
           "moon","",
       }; // Each bone is the name of a selection that you want to animate.
   };
};



class CfgModels {
   class rotation;
   class Default {
   sectionsInherit="";
   sections[]={};
   skeleton="";

   class Animations {};


   };

   class STA3_Planet {
       sectionsInherit="";
       sections[]= {};
       skeletonName="STA3_Earth_skeleton";
   };  

   class STA3_Earth : STA3_Planet {
       sectionsInherit="STA3_Planet";
       sections[]={"planet","moon","clouds"};


       class Animations {
           class STA3_Orbit : Rotation {
               animPeriod=10;
               angle0=0; 
               angle1= "rad +360";
               axis="planetaxis";
               memory = 1; 
               sourceAddress = "loop";
               type="rotation";
               source="time";
               selection="planet";
               minValue = 0;
               maxValue = 359;            
           };
           class STA3_Clouds_Orbit : Rotation {
               animPeriod=5;
               angle0=0; 
               angle1= "rad +360";
               axis="planetaxis";
               memory = 1; 
               sourceAddress = "loop";
               type="rotation";
               source="time";
               selection="clouds";
               minValue = 0;
               maxValue = 359;            
           };
           class STA3_PlanetMoon_Orbit : Rotation {
               animPeriod=10;
               angle0=0; 
               angle1= "rad +360";
               axis="planetaxis";
               memory = 1; 
               sourceAddress = "loop";
               type="rotation";
               source="time";
               selection="moon";
               minValue = 0;
               maxValue = 180;            
           };
           class STA3_Moon_Orbit : Rotation {
               animPeriod=10;
               angle0=0; 
               angle1= "rad +360";
               axis="moonaxis";
               memory = 1; 
               sourceAddress = "loop";
               type="rotation";
               source="time";
               selection="moon";
               minValue = 0;
               maxValue = 359;            
           };                
       };
   };
};

config.cpp

#define true    1
#define false    0


enum {
   DESTRUCTENGINE = 2,
   DESTRUCTDEFAULT = 6,
   DESTRUCTWRECK = 7,
   DESTRUCTTREE = 3,
   DESTRUCTTENT = 4,
   STABILIZEDINAXISX = 1,
   STABILIZEDINAXESXYZ = 4,
   STABILIZEDINAXISY = 2,
   STABILIZEDINAXESBOTH = 3,
   DESTRUCTNO = 0,
   STABILIZEDINAXESNONE = 0,
   DESTRUCTMAN = 5,
   DESTRUCTBUILDING = 1,
};
class CfgPatches {
   class STA3_Federation {
       units[] = {"STA3_Globe","STA3_PlanetHelper","STA3_Earth"};
       weapons[] = {};
       requiredAddons[] = {"STA3_F_Characters"};
       requiredVersion = 1.0;
   };
};
class CfgVehicleClasses {
class STA3_Planets {
	displayName = "Planets";
};
};
class CfgVehicles {
class NonStrategic;	//External class reference
class HouseBase : NonStrategic {};
class House : HouseBase {};
class STA3_Earth : House {
	_generalMacro = "STA3_Earth";
	author = "Abs";
	scope = 2;
	displayName = "Earth";
	model = "\STA3_Planets\STA3_Earth.p3d";
	vehicleClass = "STA3_Planets";
	class AnimationSources {
		class STA3_Orbit{};
		class STA3_Clouds_Orbit{};
		class STA3_PlanetMoon_Orbit{};
		class STA3_Moon_Orbit{};
	};
};
};

They both use the same axis for rotation.

I'm stumped, so I could use some help.

Thanks,

Abs

Share this post


Link to post
Share on other sites

yeah changing the animperiod doesn't work. You have to change the angle, just make sure it is set to "loop" instead of "clamp". Another source worth using would be "clockhour", i believe "time" takes about a second to rotate, so with "hour" it would be easier to sync the rotation of a planet because it would take half a day to rotate once. From that you could easily adjust its rotation based on earth's size.

Share this post


Link to post
Share on other sites

Thanks for the reply, Sakura_Chan! Yep, the source is loop already. Time takes about a minute or so from what I've observed.

Can you explain what the angle entries do? Also, another one I'm unclear about is min/maxValue.

Abs

Share this post


Link to post
Share on other sites

The time animation takes 1 second to go from 0 to 1 state.

If minValue is 0 and maxValue is 1, then full animation takes 1 second

If minValue is 0 and maxValue is 60, then full animation takes 60 second

During that time the selection will rotate whatever angle you requested.

With "loop" you typically want angle0 = 0 and angle1 = +360 deg, otherwise you will see jumpy animation.

This radar dish will take 1 minute to rotate 360.

		class radarX
		{
			type="rotation";
			source = "time";
			sourceAddress = "loop";
			selection="radar";
			axis="axisRadar";
			minValue=0;
			maxValue=60;
			angle0="rad 0";
			angle1="rad +360";
		};

This radar dish will take 1 second to rotate 360.

		class radarX
		{
			type="rotation";
			source = "time";
			sourceAddress = "loop";
			selection="radar";
			axis="axisRadar";
			minValue=0;
			maxValue=1;
			angle0="rad 0";
			angle1="rad +360";
		};

Share this post


Link to post
Share on other sites

Thanks, Gnat! That's done it!

Abs

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  

×