Jump to content
Sign in to follow this  
noubernou

class Animations question?

Recommended Posts

I am trying to animate the included M119 model, to make it rotate on its turret axis and its gun barrel axis via scripting commands. This is part of an attempt to add better, less tedious manual aiming to the artillery pieces.

If I am reading the biki right I should be able to access these MLOD points that already exist and are already set to animate when the mouse moves...

So I have a couple of questions:

1. Can I add animations like this in the config.cpp on binarized existing BIS models?

2. Does anyone know the selections and axis memory points to animate these, or anywhere I can start looking? I tried the bis wiki and there is a list of translated points, but I do not even know where to begin testing on that.

class Animations {
   class MoveTurntable {
       type="rotation"; // always "rotation"
       animPeriod=1; // how long it takes for the movevement to finish
       selection="OsaHlavne"; // the name of the moving object
       axis="OsaVeze"; // the name of the axis
       angle0=0 // the start angle
       angle1=-2.0; // the end angle, in radians (= degrees/57.3 = degrees * 180/p)
   };
};

The above is what I have now and I call it via a trigger in the mission to test and I get nothing.

Any help would be deeply appreciated!

Share this post


Link to post
Share on other sites

1. I haven't hacked binned models, but afaik you have to hex edit it. You can unpbo the pbo file but the 3D model is still binned and so cannot be repacked into another mod. What you are trying to do is bit tricky because you have to increase the config.cpp size

2. I'm not quite sure what exactly you are trying to do with this anim, but... selection="OsaHlavne"; ...should be selection="OtocVez"; if you are trying to rotate the turret (axis is OsaVeze). If you are trying to rotate it manually, use source ="user"...and the class is AnimationSources.

In general you should check the arma1 mlods. They have named selections nearly the same (except missing those which are new in arma2).

Share this post


Link to post
Share on other sites

I was figuring that since the model already has animations for the rotation (in its model.cfg to define reactions to the movement?) that I could get away with it just in user animations in the config.cpp for the vehicle... :(

Share this post


Link to post
Share on other sites

"MainTurret" and "MainGun" are the names of the animations. But I doubt that the "animate" command will work, because the source isnt "user". You can still try though.

Share this post


Link to post
Share on other sites

I was hoping that accessing the source and axis of those would allow me to do it. I'll have to look further into it.

Thanks for the help so far both of you. :)

Share this post


Link to post
Share on other sites

Alright, I have figured out with the help of this guy in my unit and looking at NWD's Tank FCS system (it has an automatic lead rotation follower or something in it?) a bit more about the CfgModels class and Animations...

Apparently I am able to override the CfgModels class stored in the binarized model with a entry in the config.cpp...???

Here is my CfgVehicles class...

class CfgVehicles {
class Land;

class LandVehicle: Land {
	/*extern*/ class NewTurret;
};
class StaticWeapon: LandVehicle {
	/*extern*/ class Turrets;
};
class StaticCannon: StaticWeapon {

	class Turrets: Turrets {
		/*extern*/ class MainTurret;
	};
};

class M119: StaticCannon {

	class Turrets: Turrets {
		/*extern*/ class MainTurret;
	};
};

class RM119: M119 {
	displayName = "Real M119";
                     model = "\RM119\RM119.p3d";
	class Turrets: Turrets {

		class MainTurret: MainTurret {
			weapons[] = {"RM119"};
			magazines[] = {};
			maxHorizontalRotSpeed = 0.5;
			maxVerticalRotSpeed = 0.5;
		};
	};

	class Eventhandlers {
		getin   = "_this execVM ""\RM119\scripts\dispmils.sqf"";";
                                 init    = "_this execVM ""\RM119\scripts\processMagazines.sqf"";";
                                 fired   = "_this execVM ""\RM119\scripts\handleFired.sqf"";";
	};

       class AnimationSources {

		class recoil_source {
			source = "reload";
			weapon = "M119";
		};

           class gunElevate {
               source = "user";
               animPeriod = 1; // seconds per mil
               initPhase=0;
           };

           class gunRotate {
               source = "user";
               animPeriod = 1; // seconds per mil
               initPhase=0;
           };
	};
};
};

Here is the CfgModels class, also in the config.cpp...

class CfgModels {
   class StaticWeapon;

   class RM119: StaticWeapon {

       class Base_Animations;

       class Animations: Base_Animations {

                                class MainTurretRotate_nou
		{
			type="rotationY";
			source="gunRotate";
			selection="OtocVez";
			axis="osaveze";
                                            memory = 0;
                                            sourceAddress = "clamp";
			animPeriod=1;
			minValue=-35;
			maxValue=35;
			angle0="0.035 * 2000*pi/6400";
			angle1="-0.035 * 2000*pi/6400";
		};
		class MainGunElevate_nou
		{
			type="rotationX";
			source="gunElevate";
			selection="OtocHlaven";
			axis="osahlavne";
                                            memory = 0;
                                            sourceAddress = "clamp";
			animPeriod=1;
			minValue="rad -360";
			maxValue="rad +360";
			angle0="rad -360";
			angle1="rad +360";
		};
       };
};
};

I try and animate it with this in a radio trigger:

_gun animate ["MainTurretRotate_nou", 1]

I see no movement at all, nothing... :mad: I even copy and pasted the m119.pbo into my addon file and renamed RM119.pbo and made it part of the PBO and I still see no difference. AnimationPhase always returns 0 as well!

It is frustrating because I get little to no debug information if my animations are even being recognized in the game...

Share this post


Link to post
Share on other sites

The issue is I am using the already binarized BIS model of the M119 so I dont think a separate model.cfg file will work... :( This one guy told me that you can over ride the binarized CfgModels class with one that is in your config.cpp.

Thanks for the link though, every little bit helps, its so hard to find information on the animation stuff... :(

Share this post


Link to post
Share on other sites

OK, I have it working now. I had to use the Armed Assault model and redfine the entire model.cfg to override the animations... :(

Oh well, it works, the mouse is disabled and now I just need to work on the interface to adjust the aim... its pretty bad ass though so far. Go me.

Share this post


Link to post
Share on other sites

Will this be Map Based display or say, a GPS based display? It would be cool to have a zoom in/out GPS type device, that displays coordinates, flight time and a link to switch to the MQ9.... So, you have your work cut out!!! :butbut: Let me know I I may help.

OK, I have it working now. I had to use the Armed Assault model and redfine the entire model.cfg to override the animations... :(

Oh well, it works, the mouse is disabled and now I just need to work on the interface to adjust the aim... its pretty bad ass though so far. Go me.

Share this post


Link to post
Share on other sites

The guns themselves for right now are just going to contain information on the needed elevation and azimuth to target, the guns current elevation and azimuth, the controls to adjust the elevation and azimuth, as well as the ammo count and type of rounds available (since the in game dialog doesnt display it correctly with how I am handling the multiple charge numbers). Eventually I'd like to add a simple ballistics computer (just takes a distance and azimuth and calculates elevation).

You can expect what you suggested though on the BCS/AFATDS type thing I am working on at the same time. It will have a whole suite of tools to make taking and planning fire missions much easier, including a map with previous and current open fires, displaying time of flight. Switching view to the MQ9 might be possible in the future, but that could be a fairly large task.

Anyway, this system will communicate to the guns in the battery and give them the fire missions that they need to fire. Displaying the elevation and traverse to get on target, as well as the round type and charge number to get the right shell on target.

Its a pretty all encompassing system so far. There are going to be some really nice tools for the FO as well.

I'll definitely be keeping my former platoon mates in the loop on this one as well! ;)

---------- Post added at 11:56 AM ---------- Previous post was at 11:53 AM ----------

To further clarify for other people, this system is definitely meant for multiplayer use, with people that are fairly into realistic artillery. :P

It'd take at minimum 3 people to run the whole thing. One person working as the FOO, another in the capacity of the FDC, and another gunning. The gunner could also FDC but that'd be a lot of work. Of course you'd want more gunners. I plan to support an infinite number of guns per battery and up to four or five batteries.

Share this post


Link to post
Share on other sites

wcBxVaHQMpA



There is a video for anyone interested who is following this thread. Sorry I did not post it earlier.

My problem now is handling uneven terrain that the gun may sit on. I know with a towed piece they would dig out and level the terrain. I am trying to figure out a good way of doing that.

For self-propelled systems I assume they use adjustments to the actual barrel traverse and elevation. I still need to figure out the math for that. I suck at math, so this is no doubt going to be a long and tedious process involving lots of cursing at the vectorDir function... :p

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  

×