Jump to content
Sign in to follow this  
Rav_Raven

Error in animation

Recommended Posts

Hello.

I need to make a radar antenna rotate continuously. I have the model .p3d fully defined, but can not properly configure the animation in the CPP (CfgSkeleton, CfgModels, animation, etc).

Could someone show me a similar config.cpp to determine my mistake?.

Thanks in advance.

Share this post


Link to post
Share on other sites

From Biki model config:

cfgSkeletons

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

class CfgSkeletons

{

  class MyRadarSystem_skeleton

  {

     skeletonInherit = ""; //Do we want to inherit from another skeleton?

     skeletonBones[] =        //List of bones

     {            

        "radar", "" //our fancy radar selection

     };

  };

};

cfgModels

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

class CfgModels

{

  class MyRadarSystem //real name of your model

  {

     sectionsInherit = ""; //Inherit sections from another class?

     sections[] =

     {

        "radar" //Typically used for setobjecttexture command

     };

     skeletonName = "MyRadarSystem_skeleton"; //Use our skeleton as defined above

     class Animations //define our animations

     {

        class radar_rotate

        {

         type = "rotation"; //The type of animation.

         //source = "user";   //Can use a couple of sources for this but we'll use a custom source for this example by commenting out the source

         selection = "radar"; //the bone as defined in skeleton

         axis = "radar_axis"; //since we used rotation we need an axis

         memory = true; //assuming our axis is in the memory lod; if not, set to false

         sourceAddress = "loop"; //Loop the animation

         minValue = 0; //Minimum animation value

         maxValue = 1; //maximum animation value

         angle0 = 0; //angle when not animated

         angle1 = "rad -360"; //angle when animated

        };

     };

  };

};

Now, our custom animation source in 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 radar_rotate

  {

     source = "user"; //This is an animation controlled via a script, so we use user for our source

     animPeriod = 1; //Time in seconds it takes to complete the animation

     initPhase=0; //The phase of the animation when created - in our case, goes from 0 to 1

  };

};

Now, we need a script to loop our radar array (only applies of we used a custom animation source with user) -

place this in init field of object:

myscript = [this] execVM "rotate_radar.sqf"

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

_object = _this select 0; //our unit that we executed

//while our radar system is alive we do this

while {alive _object} do

{

_object animate ["radar_rotate",1]; //animate our radar one way

sleep 1; //sleep until rotation completed

_object animate ["radar_rotate",0]; //animate our radar the opposite direction

sleep 1; //sleep again

//above will loop for as long as _object is alive

};

Hope that's a thorough enough explanation for you.

Edited by W0lle

Share this post


Link to post
Share on other sites

shouldnt it be source="radar_rotate" in your example of cfgModels/Animations?

Edited by W0lle

Share this post


Link to post
Share on other sites
shouldnt it be source="radar_rotate" in your example of cfgModels/Animations?

My understanding is that if you don't define a source, then it looks in cfgvehicles for one. The last time I tried to define a custom animation with itself as the source, I ended up with the animation following my head as if it were a turret.

Edited by W0lle

Share this post


Link to post
Share on other sites

the animation source must be a selection which you will not move during the animation process, so for example a cube at the bottom of the soldier, which you'll delete after having finished the animation and saved it.

Share this post


Link to post
Share on other sites
I need to make a radar antenna rotate continuously. I have the model .p3d fully defined...

Building or Vehicle?

Share this post


Link to post
Share on other sites

Hello everyone.

Thanks for helping me.

Synide to answer, the animation is for a building.

Here is my config.cpp:

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

{

class RAV_Radar

{

units[] = {RAV_Radar};

weapons[] = {};

requiredVersion = 1.0;

};

};

class cfgSkeletons

{

class Radar_Skeleton

{

skeletonInherit= "";

skeletonBones[]=

{

"antena",""

};

};

};

class cfgModels

{

class RAV_Radar

{

sectionsInherit= "";

sections[]=

{

"antena"

};

skeletonName = "Radar_Skeleton";

class Animations

{

class Gira_plato

{

type = "rotation";

selection = "antena";

axis = "eje_radar";

memory = true;

sourceAddress = "loop";

minValue = 0;

maxValue = 1;

angle0 = 0;

angle1 = "rad -360";

};

};

};

};

class CfgVehicleClasses

{

class RAV_Objects

{

displayName = "RAV - Objects";

};

};

class CfgVehicles

{

class All {};

class Static: All {};

class thing: Static {};

class Rav_Radar: Thing

{

scope = 2;

animated = 1;

vehicleClass = "RAV_Objects";

model="\Radar_Prueba\radar.p3d";

displayName = "Radar de Prueba";

destructype = "Destructno";

cost = 10000;

armor = 100000;

mapSize = 2;

class AnimationSources

{

class Gira_plato

{

source = "user";

animPeriod = 3;

initPhase=0;

};

};

class eventhandlers

{

init = "nil = [_this select 0] execVM ""\Radar_Prueba\gira_antena.sqf""";

};

};

}

This is the script for animation.

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

_obj = _this select 0;

while {alive _obj} do

{

_obj animate ["Gira_Plato", 1];

sleep 3;

_obj animate ["Gira_Plato", 0];

sleep 3;

};

I am currently looking for other models to compare with mine (even unsuccessfully).

Greetings to all from Argentina.

Edited by W0lle

Share this post


Link to post
Share on other sites

ok, well then here's one i did up for rock (i'm sure he won't mind me posting the details) a while back.

First the model.

Rock's model consisted of a tower with a dish on top. And the dish needed to rotate continuosly. He already had most of the config & model.cfg done just couldn't quite get it working properly. So, he had a named selection that encompassed the dish. See picture. And the appropriate axis defined in the Memory Lod by a couple of points.

dish.png

Next you need a model.cfg describing the skeleton & the model animation.

Example.

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

class CfgSkeletons {

 class Default;

 class rksl_radar_tower1_Bones: Default {

  isDiscrete=1;

  skeletonInherit="";

  skeletonBones[]={"RADAR_DISH",""};

 };

};

class Rotation {type="rotation";memory=1;minValue=0;maxValue=1;angle0=0;angle1=1;};

class cfgModels {

 class Default;

class rksl_radar_tower1: Default {

sectionsInherit="";

skeletonName="rksl_radar_tower1_Bones";

sections[]={};

class Animations {

  class RADAR_DISH: Rotation {

      type="rotation";

      source="radar_dish_anim";

       sourceAddress="loop";

selection="RADAR_DISH";

axis="axis_RADAR_DISH";

memory=1;

minValue=0;

      maxValue=15;

       angle0="rad -360";

      angle1="rad +360";

  };

};

};

};

Finally, you need a config.cpp for the pbo that details the model.

Example.

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

class CfgPatches {

class RKSL_TI40AirportObjects {

units[]={"rksl_radar_tower1"};

weapons[]={};

requiredVersion=0.1;

requiredAddons[]={"CAData"};

};

};

class CfgVehicles {

class House;

class rksl_radar_tower1: House {

scope = public;

access=ReadOnly;

model = "\RKSL\rksl-ti40-obj\airport\rksl_radar_tower1.p3d";

icon = "\Ca\buildings\Icons\i_camosmall_CA.paa";

displayName = "Radar Tower 40m";

animated = true;

vehicleClass = "RKSL_Objects";

nameSound = "bunker";

accuracy = 0.2; // accuracy needed to recognize type of this target

typicalCargo[] = {};

destrType = "DestructBuilding";

transportAmmo = 0;

transportRepair = 0;

transportFuel = 0;

mapSize = 10;

cost = 0;

armor = 8000;

class MarkerLights {

class RedBlinking {

 name="cerveny pozicni blik";

 color[]={1.0,0.1,0.1,1};

 ambient[]={0.1,0.01,0.01,1};

 brightness=0.01;

 blinking=true;

 };

};

class AnimationSources {

class radar_dish_anim {source="time";sourceAddress="loop";};

};

};

 class Land_rksl_radar_tower1: rksl_radar_tower1 {

   scope=protected;

   access=ReadOnly;

model = "\RKSL\rksl-ti40-obj\airport\rksl_radar_tower1.p3d";

 };

};

The above setup resulted in a radar tower that rotated continuously without regard for scripts etc. so should be sufficient for your needs.

Cheers, Sy.

I think from memory it did 15 rpm...

Edited by W0lle

Share this post


Link to post
Share on other sites

With your help I could solve it.

Thank you very much everybody.

Greetings.

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  

×