Jump to content
Sign in to follow this  
UNN

Animations

Recommended Posts

Animations

Turret Direction:

Hi,

This is actually a response to a question posted on the wiki, but I thought I would post the reply here because it might be of interest to others, plus the forum is better suited for discussions.

Quote[/b] ]Any suggestion on how to get weapon direction for secondary turrets like commander's M2 in Abrams?

Any animation thats defined in a model.cfg file, is now available in game using the command animationPhase. For example to get the direction of the commanders turret for the M1A1 you could run this script:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[MYM1A1] ExecVM "TurretDir.sqf"

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_Tank=_This Select 0;

WaitUntil

       {

       _CommandT=Deg (_Tank AnimationPhase "obsturret");

       Hint Format ["Local Command Turret Dir %1",_CommandT];

       False

       };

However, unlike the weaponDirection command, the direction is returned relative to any parent turrets and the vehicles main body. So to get the direction in world space, you would have to modify the above script:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_Tank=_This Select 0;

WaitUntil

       {

       _Body=GetDir _Tank;

       _MainT=Deg (_Tank AnimationPhase "mainturret");

       _CommandT=Deg (_Tank AnimationPhase "obsturret");

       Hint Format ["World Command Turret Dir %1",_Body+_MainT+_CommandT];

       False

       };

The principle should work for any number of turrets you define in model.cfg, and is just one example of how useful the new animation system is in Arma.

Many of the defined animations for vehicles can be found in the Models BI made public, but there are still plenty that are not documented. Fortunately the naming convention appears to use the same names as the animation sources, so it didn't take longer to figure out the animations for the M1A1.

There are some limits to Arma's animations. One is, you cant seem to define user animations that operate at the same speed as the games animations. Others are not so obvious, like the animations for dampers, only working when the vehicle is moving.

Magazine Ammo Count:

Here's an example mission showing how you can use an animation phase to calculate the amount of rounds left to fire in a magazine of a Hummers M2 machine gun. It will also work for the grenade launcher. It will work with TOW launcher to, but you need to modify the config.

Ammo Count Example

The script for the Hummer with an M2 machine gun, looks like this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_Vehicle=_This Select 0;

_MaxRounds=100;

WaitUntil

       {

       _Count=_Vehicle AnimationPhase "ammo_belt_rotation";

       If (_Count>=(1/_MaxRounds)) Then

               {

               _Count=Ceil (_Count*_MaxRounds);

               }

               Else

               {

               _Count=0;

               };

       Hint Format ["Ammo Count is %1",_Count];

       False

       };

So far I've only tested it with the BI Hummer.

If anyone has any other useful tricks with animations, please post them here.

Cheers

Share this post


Link to post
Share on other sites

Thanks for posting UNN,

Quote[/b] ]There are some limits to Arma's animations. One is, you cant seem to define user animations that operate at the same speed as the games animations. Others are not so obvious, like the animations for dampers, only working when the vehicle is moving.

do you mean that user anim can't go very fast like some hardcoded anim ?

Share this post


Link to post
Share on other sites
Quote[/b] ]There are some limits to Arma's animations. One is, you cant seem to define user animations that operate at the same speed as the games animations

Do you mean you can't execute the script and then run anim as fast as defined in model.cfg animations ? wink_o.gif i guess using execVM, spawn or call will speed it up

Share this post


Link to post
Share on other sites
Quote[/b] ]Thanks for posting UNN

No worries, haven't seen a lot about Arma's new animation system on the forum. Which is a shame, as looks as though it could be very powerful. I do have to add more to the above example for gun elevation, but I need to figure out the VectorUp to degree maths before I can do that.

Quote[/b] ]do you mean that user anim can't go very fast like some hardcoded anim ?

Yeah, that’s about it. For example, if I setup a user defined anim called copyturret, that mimics the animation phase of the main turret. Then I run this script:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">WaitUntil

       {

       _Tank Animate ["copyturret",_Tank AnimationPhase "mainturret"]

       False

       };

There is a small, but visible delay, between the main turret and the user animation I setup. Even though they have exactly the same settings in the config and model.cfg.

It all centres around the AnimPeriod setting in model.cfg. Setting it to 0 does not result in an instant execution of the requested animation phase, in fact it's quite slow. I eventually used AnimPeriod=0.00001, to get the quickest reaction. Ok probably some of the extra zero's after the decimal place aren't needed, it's just to be on the safe side.

Perhaps I need to run the script in a more aggressive while loop? Or accept the fact that user defined animations executed using scripts, will never be as fast as the games hard coded animations.

P.S Has anyone experimented with overriding the animation sources? There is very little info about this on the wiki.

Share this post


Link to post
Share on other sites
Quote[/b] ]Arma's new animation system

that's  almost the only arma feature i like smile_o.gif Though there're no official examples for tank's dampers for example.

Quote[/b] ]P.S Has anyone experimented with overriding the animation sources? There is very little info about this on the wiki.

Examples ? i can only think of moving gun barrel via script to achieve angle needed.

Quote[/b] ]It all centres around the AnimPeriod setting in model.cfg

I'm not sure where it's set wink_o.gif Arma example

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> class AnimationSources {

class VTOL {

source = "user";

animPeriod = 2.5;

};

};

Quote[/b] ]There is a small, but visible delay, between the main turret and the user animation I setup.

of course there'll be a delay. Cause standart anim is executed and  only after this AnimationPhase command will work. Thus i think your example is kinda artificial

I got one problem i'm interested at. Is there a way to make recoil with confog only ? "Revoving" anim source is not working for vehicle's weapons. "reload" works for the whole mag. Why there's no animation source for _firing_ vehicle's weapon. I don't like to make recoil via scripts (it's working but...)

Share this post


Link to post
Share on other sites
Quote[/b] ]that's  almost the only arma feature i like

It's certainly a much welcome feature, add to that the ability to animate proxies now. But let's not overlook the mass of additional new scripting commands. For me at least, I think ExitWith has got to be the most used, from the current batch of new arrivals?

Quote[/b] ]I'm not sure where it's set

Exactly, all these examples are based on inherited values. What would really be impressive is, showing us where in the games default config files, the base classes for animations and model,cfg are defined. Now that would actually be something to wink about for a change smile_o.gif

Quote[/b] ]of course there'll be a delay. Cause standart anim is executed and  only after this AnimationPhase command will work.

For me, it does not make sense. Unless BI have implemented a pre-defined delay for user animations. The worst I would expect, is a less than smooth animation. Remeber, my example calls a command to represent the current animation phase. So that should reflect the current state of the engine animation at that point in time? What it appears to actually represent, is the state of the animation phase, some time after. Think of it as a cushioning effect.

Quote[/b] ]I got one problem i'm interested at. Is there a way to make recoil with confog only ?

Not that I can see, there is no animation source for firing available to all vehicle classes. The current animations assigned to weapons do not count on both accounts.

First you can't reference a weapon directly, as an object pointer. Also the BI examples made public regarding animation sources and firing, seem explicitly to referrer to infantry weapons only.

However the delays I'm concerned with, may only be obvious when your sharing animations across separate objects, that exists independently, using scripts. If for example you applied an animation to a gun selection using a function, from the vehicles fired event, there should be enough going on to distract the observer from any slight delay?

Share this post


Link to post
Share on other sites
Quote[/b] ]Exactly, all these examples are based on inherited values. What would really be impressive is, showing us where in the games default config files, the base classes for animations and model,cfg are defined. Now that would actually be something to wink about for a change

model.cfg is preprocessed during binarization wink_o.gif i guess you know it.

... to be continued

Share this post


Link to post
Share on other sites

this may be useful

KEY

SUSR_ = suspension right

SUSL_ = suspension left

RWHL_ = road wheel left

RWHR_ = road wheel right

DRIVR = Drive wheel right

DRIVL = Drive wheel left

RETL_ = return wheel/idler left

RETR_ = return wheel/idler right

Tor_L_ = torsion bar left

Tor_R_ = torsion bar right

the rest should be understandable, you should note kenji wrote this before bis example models were available hence the non czech name selections

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class CfgSkeletons

{

class RHS_T64B_Bones

{

isDiscrete=1;

skeletonInherit = ""; //Inherit all bones from class Car.

skeletonBones[]=

{

"levy predni","",

"levy dalsi","",

"levy prostredni","",

"levy zadni","",

"pravy predni","",

"pravy dalsi","",

"pravy prostredni","",

"pravy zadni","",

"SUSR_1","",

"SUSR_2","",

"SUSR_3","",

"SUSR_4","",

"SUSR_5","",

"SUSR_6","",

"SUSR_7","",

"SUSR_8","",

"SUSR_9","",

"SUSR_10","",

"SUSR_11","",

"SUSR2","SUSR_2",

"SUSR4","SUSR_4",

"SUSR6","SUSR_6",

"SUSR8","SUSR_8",

"SUSR10","SUSR_10",

"SUSR1","SUSL_1",

"SUSL3","SUSL_3",

"SUSL5","SUSL_5",

"SUSL7","SUSL_7",

"SUSL9","SUSL_9",

"SUSL11","SUSL_11",

"RWHL_1","SUSL_1",

"RWHL_2","SUSL_3",

"RWHL_3","SUSL_5",

"RWHL_4","SUSL_7",

"RWHL_5","SUSL_9",

"RWHL_6","SUSL_11",

"RWHR_1","SUSR_1",

"RWHR_2","SUSR_3",

"RWHR_3","SUSR_5",

"RWHR_4","SUSR_7",

"RWHR_5","SUSR_9",

"RWHR_6","SUSR_11",

"Tor_L_1","SUSL_1",

"Tor_L_2","SUSL_3",

"Tor_L_3","SUSL_5",

"Tor_L_4","SUSL_7",

"Tor_L_5","SUSL_9",

"Tor_L_6","SUSL_11",

"Tor_R_1","SUSL_1",

"Tor_R_2","SUSL_3",

"Tor_R_3","SUSL_5",

"Tor_R_4","SUSL_7",

"Tor_R_5","SUSL_9",

"Tor_R_6","SUSL_11",

"DRIVL","",

"DRIVR","",

"RETL_1","",

"RETL_2","",

"RETL_3","",

"RETL_4","",

"RETL_5","",

"RETR_1","",

"RETR_2","",

"RETR_3","",

"RETR_4","",

"RETR_5","",

"Hatch_driver","",

"MainTurret","",

"IR_Search","MainTurret",

"MainGun","MainTurret",

"MainGun_Recoil","MainGun",

"Hatch_gunner","MainTurret",

"com_coppula","MainTurret",

"com_gun","com_coppula",

"com_IR_Search","com_coppula",

"Hatch_commander","com_coppula"

};

};

};

class CfgModels

{

class RHS_T64B

{

sectionsInherit = "";

sections[] ={"N1","N2","N3","-1","-2","zbytek","pas_P","pas_L","pravy zadni","pasanimL","pasanimP","levy zadni","L svetlo", "P svetlo","RWHR_1","RWHR_2","RWHR_3","RWHR_4","RWHR_5","RWHR_6","RWHL_1","RWHL_2","RWHL_3","RWHL_4","RWHL_5","RWHL_6","RETR_1","RETR_2","RETR_3","RETR_4","RETR_5","RETL_1","RETL_2","RETL_3","RETL_4","RETL_5","DRIVL","DRIVR","SUSL_1","SUSL_2","SUSL_3","SUSL_4","SUSL_5","SUSL_6","SUSL_7","SUSL_8","SUSL_9","SUSL_10","SUSL_11","SUSR_1","SUSR_2","SUSR_3","SUSR_4","SUSR_5","SUSR_6","SUSR_7","SUSR_8","SUSR_9","SUSR_10","SUSR_11","Mainturret","Maingun","com_coppula","com_gun","Hatch_gunner","Hatch_driver","Hatch_commander","IR_Search","com_IR_Search"};

skeletonName = "RHS_T64B_Bones";

class Animations

{

/////////////// road wheel right//////////

class RHS_T64_RWHR_1

{

type = "rotationX";

source = "wheelR";

selection = "RWHR_1";

axis = "";

memory = true;

sourceAddress = "loop";

minValue = 0;

maxValue = 1;

angle0 = 0;

angle1 = "rad -360";

};

class RHS_T64_RWHR_2 :RHS_T64_RWHR_1

{

selection = "RWHR_2";

};

class RHS_T64_RWHR_3 :RHS_T64_RWHR_1

{

selection = "RWHR_3";

};

class RHS_T64_RWHR_4 :RHS_T64_RWHR_1

{

selection = "RWHR_4";

};

class RHS_T64_RWHR_5 :RHS_T64_RWHR_1

{

selection = "RWHR_5";

};

class RHS_T64_RWHR_6 :RHS_T64_RWHR_1

{

selection = "RWHR_6";

};

/////////////// Suspension right

class RHS_T64_SUSR_1

{

type = "translationY";

source = "damper";

selection = "SUSR_1";

axis = "";

memory = true;

minValue = -0.2;

maxValue = 0.2;

};

class RHS_T64_SUSR_2 :RHS_T64_SUSR_1

{

selection = "SUSR_2";

};

class RHS_T64_SUSR_3 :RHS_T64_SUSR_1

{

selection = "SUSR_3";

};

class RHS_T64_SUSR_4 :RHS_T64_SUSR_1

{

selection = "SUSR_4";

};

class RHS_T64_SUSR_5 :RHS_T64_SUSR_1

{

selection = "SUSR_5";

};

class RHS_T64_SUSR_6 :RHS_T64_SUSR_1

{

selection = "SUSR_6";

};

class RHS_T64_SUSR_7 :RHS_T64_SUSR_1

{

selection = "SUSR_7";

};

class RHS_T64_SUSR_8 :RHS_T64_SUSR_1

{

selection = "SUSR_8";

};

class RHS_T64_SUSR_9 :RHS_T64_SUSR_1

{

selection = "SUSR_9";

};

class RHS_T64_SUSR_10 :RHS_T64_SUSR_1

{

selection = "SUSR_10";

};

class RHS_T64_SUSR_11 :RHS_T64_SUSR_1

{

selection = "SUSR_11";

};

/////////////// return wheel right

class RHS_T64_RETR_1 :RHS_T64_RWHR_1

{

selection = "RETR_1";

};

class RHS_T64_RETR_2 :RHS_T64_RWHR_1

{

selection = "RETR_2";

};

class RHS_T64_RETR_3 :RHS_T64_RWHR_1

{

selection = "RETR_3";

};

class RHS_T64_RETR_4 :RHS_T64_RWHR_1

{

selection = "RETR_4";

};

class RHS_T64_RETR_5 :RHS_T64_RWHR_1

{

selection = "RETR_5";

};

////////////// Drive wheel right

class RHS_T64_DRIVR :RHS_T64_RWHR_1

{

selection = "DRIVR";

};

////////////// road wheel left////////////

class RHS_T64_RWHL_1

{

type = "rotationX";

source = "wheelR";

selection = "RWHL_1";

axis = "";

memory = true;

sourceAddress = "loop";

minValue = 0;

maxValue = 1;

angle0 = 0;

angle1 = "rad -360";

};

class RHS_T64_RWHL_2 :RHS_T64_RWHL_1

{

selection = "RWHL_2";

};

class RHS_T64_RWHL_3 :RHS_T64_RWHL_1

{

selection = "RWHL_3";

};

class RHS_T64_RWHL_4 :RHS_T64_RWHL_1

{

selection = "RWHL_4";

};

class RHS_T64_RWHL_5 :RHS_T64_RWHL_1

{

selection = "RWHL_5";

};

class RHS_T64_RWHL_6 :RHS_T64_RWHL_1

{

selection = "RWHL_6";

};

/////////////// Suspension left

class RHS_T64_SUSL_1

{

type = "translationY";

source = "damper";

selection = "SUSL_1";

axis = "";

memory = true;

minValue = -0.2;

maxValue = 0.2;

};

class RHS_T64_SUSL_3 :RHS_T64_SUSL_1

{

selection = "SUSL_3";

};

class RHS_T64_SUSL_2 :RHS_T64_SUSL_1

{

selection = "SUSL_2";

};

class RHS_T64_SUSL_4 :RHS_T64_SUSL_1

{

selection = "SUSL_4";

};

class RHS_T64_SUSL_5 :RHS_T64_SUSL_1

{

selection = "SUSL_5";

};

class RHS_T64_SUSL_6 :RHS_T64_SUSL_1

{

selection = "SUSL_6";

};

class RHS_T64_SUSL_7 :RHS_T64_SUSL_1

{

selection = "SUSL_7";

};

class RHS_T64_SUSL_8 :RHS_T64_SUSL_1

{

selection = "SUSL_8";

};

class RHS_T64_SUSL_9 :RHS_T64_SUSL_1

{

selection = "SUSL_9";

};

class RHS_T64_SUSL_10 :RHS_T64_SUSL_1

{

selection = "SUSL_10";

};

class RHS_T64_SUSL_11 :RHS_T64_SUSL_1

{

selection = "SUSL_11";

};

/////////////// return wheel left

class RHS_T64_RETL_1 :RHS_T64_RWHL_1

{

selection = "RETL_1";

};

class RHS_T64_RETL_2 :RHS_T64_RWHL_1

{

selection = "RETL_2";

};

class RHS_T64_RETL_3 :RHS_T64_RWHL_1

{

selection = "RETL_3";

};

class RHS_T64_RETL_4 :RHS_T64_RWHL_1

{

selection = "RETL_4";

};

class RHS_T64_RETL_5 :RHS_T64_RWHL_1

{

selection = "RETL_5";

};

////////////// Drive wheel left

class RHS_T64_DRIVL :RHS_T64_RWHL_1

{

selection = "DRIVL";

};

////////////// Turret

class RHS_T64_MainTurret

{

selection = "Mainturret";

type="rotationY";

source="mainTurret";

axis="axis_turret";

animPeriod=0;

memory=1;

minValue="rad -360";

maxValue="rad +360";

angle0="rad -360";

angle1="rad +360";

};

class RHS_T64_MainGun

{

selection = "MainGun";

type="rotationX";

source="mainGun";

axis="axis_Gun";

animPeriod=0;

memory=1;

minValue="rad -360";

maxValue="rad +360";

angle0="rad -360";

angle1="rad +360";

};

/////////////// IR search light gunner

class RHS_T64_GUN_Search

{

selection = "IR_Search";

type="rotationX";

source="mainGun";

axis="axis_IR_Search";

animPeriod=0;

memory=1;

minValue="rad -5";

maxValue="rad +15";

angle0="rad -5";

angle1="rad +15";

};

////////////// commander coppula

class RHS_T64_com_coppula

{

selection = "Com_coppula";

type="rotationY";

source="obsTurret";

axis="axis_com_coppula";

animPeriod=0;

memory=1;

minValue="rad -360";

maxValue="rad +360";

angle0="rad -360";

angle1="rad +360";

};

class RHS_T64_com_Gun

{

selection = "com_Gun";

type="rotationX";

source="obsGun";

axis="axis_com_Gun";

animPeriod=0;

memory=1;

minValue="rad -360";

maxValue="rad +360";

angle0="rad -360";

angle1="rad +360";

};

///////////////// IR search light commander

class RHS_T64_com_com_IR_Search

{

selection = "com_IR_Search";

type="rotationX";

source="obsGun";

axis="axis_com_IR_Search";

animPeriod=0;

memory=1;

minValue="rad -20";

maxValue="rad +60";

angle0="rad -20";

angle1="rad +60";

};

///////////////// Hatches

class RHS_T64_Hatch_driver

{

selection = "Hatch_driver";

type="rotation";

source="hatchDriver";

axis="axis_Hatch_driver";

animPeriod=0;

memory=1;

minValue="rad 0";

maxValue="rad +300";

angle0="rad 0";

angle1="rad +300";

};

class RHS_T64_Hatch_gunner

{

selection = "Hatch_gunner";

type="rotation";

source="hatchGunner";

memory=1;

axis= "axis_Hatch_gunner";

animPeriod=0;

minValue = 0;

maxValue = 1;

angle0 = 0;

angle1= rad -90;

};

class RHS_T64_Hatch_commander

{

selection = "Hatch_commander";

type = "rotation";

memory=1;

source = "HatchCommander";

axis= "axis_Hatch_commander";

animPeriod=0;

minValue = 0;

maxValue = 1;

angle0 = 0;

angle1= rad -90;

};

};

};

class RHS_T64B_SLA : RHS_T64B {};

class RHS_T64BU : RHS_T64B {};

};

Share this post


Link to post
Share on other sites
Quote[/b] ]model.cfg is preprocessed during binarization

Sorry, I did not explain myself very well. Initially I assumed animPeriod and some of the other settings defaulted to specific values, if you did not define them in your cfg file. It was those values I was interested in.

I'm now begging to wonder if there used at all, at least for rotational animations. Linear animations are different, but I would have to dig out my old tests to double check.

I did some more testing with different values for animPreiod. But rather than talk about turrets I will use the actual example I'm testing.

I have a vehicle setup with this animation, so I can read the direction from the vehicles animation source:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class directionanim

       {

       type="rotationY";

       source="direction";

       selection="direction anim";

       axis="axis";

       animPeriod=0.0001;

       minValue="rad -360";

       maxValue="rad +360";

       angle0="rad -360";

       angle1="rad +360";

       sourceAddress="loop";

       initPhase=0;

       };

I have another object setup with this animation, which is driven by the above animationphase.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class RotateY

       {

       type="rotationY";

       source="user";

       selection="yrotate";

       axis="axis";

       sourceAddress="loop";

       animPeriod=0.0001;

       minValue="rad -360";

       maxValue="rad +360";

       angle0="rad +360";

       angle1="rad -360";

       initPhase=0;

       };

The script that coordinates both animations looks like this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">WaitUntil

       {

       _Object Animate ["RotateY",_Vehicle AnimationPhase "directionanim"];

       False

       };

The problem is, when I turn the vehicle, the object is animated correctly. Only it always lags behind the vehicle slightly. And takes about a second to finally catch up.

So I tried changing animPeriod to 0, I tried removing it all together. I also tried it with a value of 2. In every case the object behaved the same way, regardless of what I set the animPeriod to. I do wonder if animPeriod is even used?

I can also define the script like this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">WaitUntil

       {

       _Object Animate ["RotateY",Rad (GetDir _Vehicle)];

       False

       };

The same thing still happens.

When I return to using the traditional OFP method:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">WaitUntil

       {

       _Object SetDir (GetDir _Vehicle);

       False

       };

Then every thing works fine, no delay.

In another quick test I changed the script to look like this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">WaitUntil

       {

       _Object SetDir (Deg (_Vehicle AnimationPhase "directionanim"));

       False

       };

That also works ok, no obvious delay when setting the direction.

So all this leads me to believe that User animations have an inherent delay built into them. Or are my deductions still flawed?

It would be handy if someone could double check this in game, rather than just make assumptions.

Share this post


Link to post
Share on other sites
Quote[/b] ]I'm not sure where it's set wink_o.gif Arma example

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

class AnimationSources {

class VTOL {

source = "user";

animPeriod = 2.5;

};

};

bdfy doesn't like to answer questions direclty wink_o.gif , but I think he ment (and I agree) that you have to look in the config\animSources\animperiod and change that value if you want to play a user anim faster, at least have a look at it (It might be only for translation).

In your case you gonna have to define a new animationsource in order to define the animperiod.

Quote[/b] ]I got one problem i'm interested at. Is there a way to make recoil with confog only ? "Revoving" anim source is not working for vehicle's weapons. "reload" works for the whole mag. Why there's no animation source for _firing_ vehicle's weapon. I don't like to make recoil via scripts (it's working but...)

you can use multipler param to make the weapon recoil for each shot and give it 1000 mags (or script), but that's a crappy solution.

I did it via script (this animate ... )for RHS hind and I'm quite happy with the result.

Share this post


Link to post
Share on other sites
Quote[/b] ]you can use multipler param to make the weapon recoil for each shot and give it 1000 mags (or script), but that's a crappy solution.

I did it via script (this animate ... )for RHS hind and I'm quite happy with the result.

Wierd solution wink_o.gif I don't want one bullet mags.

Share this post


Link to post
Share on other sites

haha, I was waiting for bd to pop up biggrin_o.gif

Quote[/b] ]Wierd solution wink_o.gif I don't want one bullet mags.

let's imagine you have a weapon with a long belt.

Why don't you wanna do it via script... performance ?

Share this post


Link to post
Share on other sites
Quote[/b] ]bdfy doesn't like to answer questions direclty

In other words, he doesn't know the answer. That’s fine if someone doesn't know, but they should at least say so, or not reply in the first place? Honesty isn't that expensive.

I still stand by my previous two posts, neither a value of 0 nor 0.00001 for animPeriod will speed up the animation. That’s been tested in game, it's not speculation.

Share this post


Link to post
Share on other sites

^ relax UNN I'm not sure he ment this, and like me he's trying to help.

Did you try to define the animperiod in the animsources or not ?

Share this post


Link to post
Share on other sites
Quote[/b] ]In other words, he doesn't know the answer.

and that's exactly what i said wink_o.gif - "I'm not sure where it's set ". Yuo can see animperiod in model.cfg and animsources.

Why do you look for implication in my words ? ))

Quote[/b] ]let's imagine you have a weapon with a long belt.

Why don't you wanna do it via script... performance ?

yes. +i like to have as mich hardcoded things as possible.

Quote[/b] ]Not that I can see, there is no animation source for firing available to all vehicle classes. The current animations assigned to weapons do not count on both accounts.

First you can't reference a weapon directly, as an object pointer. Also the BI examples made public regarding animation sources and firing, seem explicitly to referrer to infantry weapons only.

??

In the cfgVehicles

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> class AnimationSources

{

class Recoil

{

source="reload";

weapon="flak20mm";

animPeriod = 0.1;

};

};

Thus Recoil anim source appears for vehicles weapon. But revolving is nor working in this way

Share this post


Link to post
Share on other sites
Quote[/b] ]Why do you look for implication in my words ?

Well I must admit, I'm a little confused by your replies. I've already posted examples of the animations I'm using in Model.cfg. Look at the ninth post down, the post after Jezz.

Quote[/b] ]Thus Recoil anim source appears for vehicles weapon.

Well perhaps something constructive might come out of this. There does appear to be some missing animation sources amongst the Wiki, the Model.cfg provided by BI and user made addon configs?

I could not find source="reload" in the model.cfg for vehicles from BI, neither could I find it in Wiki: Animation sources. But I did find this in the BI cfg.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">Source="belt_rotation";

That's not on the wiki either. Perhaps it will work for your recoil animations?

Share this post


Link to post
Share on other sites
Quote[/b] ]Source="belt_rotation";

it's defined in weapons.pbo

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> class AnimationSources {

class belt_rotation {

source = "reload";

weapon = "M2";

};

};

got it ? You can define animation for vehicle magazine reload.

Share this post


Link to post
Share on other sites
Quote[/b] ]on the same subject

Cheers Simba, that makes it clear. I think I understand how reload is used now, it's an animation controller for weapons rather than vehicles. But it has to be defined in the Config of a vehicle, as an animation source? It actually drives the animation ammo_belt_rotation which was the one I was looking at in game. I didn't know you could reference animation sources that way.

BTW The reload animation is a rotation anim, it starts at 1 and decreases by the number of rounds fired from the current magazine until it reaches 0. I got as far as this, trying to make it into a translation anim:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class myammo_belt_rotation

       {

       type="translationZ";

       source="mybelt_rotation";

       selection="test selection";

       axis="axis";

       memory=1;

       sourceAddress="loop";

       minValue=0;

       maxValue=0.01;

       offset0=10;

       offset1=0;

       };

You can see the selection moves a tiny amount every time a round is fired. But because there are 100 rounds in an MG mag and it reloads so quickly. You can hardly see the animation being played out. If you change it to a rotation anim, then the movement becomes obvious. maxValue is reached every time a round fires, with a hundred rounds per M2 mag, it worked out at 1/100=0.01.

Perhaps not much use to you. But the ammo_belt_rotation selection can be used to return the amount of ammo left in a magazine. So that will come in handy. I've posted an example mission at the top of the thread, for anyone interested.

Share this post


Link to post
Share on other sites

^you got the theory right, I understood this in a empirical way but your explanation is much clearer. smile_o.gif

Quote[/b] ]You can see the selection moves a tiny amount every time a round is fired. But because there are 100 rounds in an MG mag and it reloads so quickly. You can hardly see the animation being played out. If you change it to a rotation anim, then the movement becomes obvious. maxValue is reached every time a round fires, with a hundred rounds per M2 mag, it worked out at 1/100=0.01.

have a little doubt :

in your example,

for translation : anim is played only for the first 1/100 of your mag. (first round of a 100 rounds mag)

for rotation : anim is played for each 1/100 of the chamber reload. (each bullet)

right ?

Quote[/b] ]Perhaps not much use to you. But the ammo_belt_rotation selection can be used to return the amount of ammo left in a magazine. So that will come in handy. I've posted an example mission at the top of the thread, for anyone interested.

thanks for the tip, might come in handy.

Share this post


Link to post
Share on other sites

for any addonmaker interested :

HOW TO SIMULATE RECOIL ON TURRET MGs wow_o.gif

first create the animsource.

The source is "user" because the anim will be triggered by an external script.

note also that the animperiod is very short, this is where and not in the cfgmodel that the anim period will be picked by the engine !

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class AnimationSources

{

class recoilpk

{

source = "user";

animPeriod = 0.03;

initPhase=0;

};

};

Then configure the cfgmodel.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> class pk1_recoil

{

type="translation";

selection="gatling";

axis="gatling_axis";

source = "recoilpk";

offset0=0.0000;

offset1=-0.0300000;

};

-source: recoilpk, explained above.

-selection : gatling, wish is basically the same selection as otochlaven in the model.

gatling must be of course correcly setup in the cfgskeleton and cfgmodel.

-axis : 2 points along the main gun axis, don't forget to redefine otochlaven and otocvez selection so they include "gatling_axis" selection !

if you don't do so, those points won't rotate with the weapon...

-offset : length of displacement.

Job is nearly done, now what you got to do is write a tiny script to trigger the anim, this is done via the "fired" eventhandler in your cfgvehicle.

write this in with the other evenhandlers of your config :

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">fired = " _this exec ""\MyAddon\scripts\fired.sqs"";";

more info about eventhandlers

as said in the biki, amongst other things the weapon name is

sent to the script, we need it in order to trigger the anim only when our pk ( RHS_pk1) is shot.

last step, the fired.sqs script :

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_unit = _this select 0

_weapon= _this select 1

?(_weapon== "RHS_pk1"): goto "pk1"

#pk1

_unit animate ["pk1_recoil",1]

~0.03

_unit animate ["pk1_recoil",0]

~0.03

exit

delays must be carefully chosen, do not use the exact reload time of the weapon, you must leave a buffer in case the game lags.

that's the little weakness of this solution.

-------------------

note : you can do a bunch of anims for turrets.

for translation use the one explained above, this will work for rotations too but a better solution exists.

in the animsources write this instead :

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> class AnimationSources

{

class pk1_belt

{

source = "reload";

weapon = RHS_pk1;

};

};

adapt the cfgmodel so it's a rotation anim, you don't need the scripting part.

cheers,

simba

Share this post


Link to post
Share on other sites
Quote[/b] ]for translation : anim is played only for the first 1/100 of your mag. (first round of a 100 rounds mag)

for rotation : anim is played for each 1/100 of the chamber reload. (each bullet)

right ?

Yeah and the length of time it takes to reload each round in the config, is the time it takes to move to the next phase.

To animate a six barrelled rotating gun, with a hundred rounds per mag, you would have:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class ammo_belt_rotation

      {

      type="rotationZ";

      source="belt_rotation";

      selection="barrel selection";

      axis="axis";

      memory=1;

      sourceAddress="loop";

      minValue=0;

      maxValue=0.01;

      Angle0=0;

      Angle1=Rad 60;

      };

Share this post


Link to post
Share on other sites
It all centres around the AnimPeriod setting in model.cfg. Setting it to 0 does not result in an instant execution of the requested animation phase, in fact it's quite slow. I eventually used AnimPeriod=0.00001, to get the quickest reaction. Ok probably some of the extra zero's after the decimal place aren't needed, it's just to be on the safe side.

I do not think AnimPeriod is the source of the lag here, but there is a way to avoid animPeriod in user defined animations completely, and that is by using "direct" as a source instead of "user". I am adding "direct" into the http://community.bistudio.com/wiki/Model_Config, perhaps it may help you here.

Share this post


Link to post
Share on other sites
Quote[/b] ]I do not think AnimPeriod is the source of the lag here, but there is a way to avoid animPeriod in user defined animations completely, and that is by using "direct" as a source instead of "user".

Thanks, I will give it a try ASAP. I did notice on some occasions in MP, the anim phase matched ok, after a complete cycle of a WaitUntil loop. But direct sounds like it might result in cleaner code.

If you also get the chance, I'm sure some more insight into how;

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">sourceAddress="mirror";

works. Would also be appreciated.

Either way, cheers

Share this post


Link to post
Share on other sites

"mirror" inverts animations outside of the limits given by "minValue" and "maxValue".

So if you would use an animation with "mirror" and

minValue=0;

maxValue=0.5;

the animation plays from sourceValue 0-0.5 and then goes back between sourceValue 0.5-1, so you end up on angle0 point when reaching sourceValue 1

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  

×