Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17

Thread: Animation phase - mils or radians?

  1. #11
    Interesting point!

    A problem I came across:
    There might be more than one radar device, e.g. a long range radar (slow 360°-rotation, spotting targets) and 2-sector short range radar devices (fast oscillating movement, exact target identification). Well, the long range radar could be defined as the vehicle's radar, but what's about the others?
    Tempus Fugit.

  2. #12
    </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (Colonel_Klink @ Oct. 19 2002,13:11)</td></tr><tr><td id="QUOTE">Excellent discussion, guys. Does anyone ***know how to make the animation run indefinite (foreaver), or a tleast until a command to stop is given. Then perhaps another command to start again from the last stop point. Just a thought.[/QUOTE]<span id='postcolor'>
    Yes, I&#39;ll try to post the code later today (I&#39;ll base it on rads - you can always change it to mils if this turns out to be incorrect). Right in the middle of some addAction stuff right now.

    Prospero




  3. #13
    Script-controllable Rotations - via angle and rate.
    ---------------------------------------------------------

    OK, this assumes that animations are based on radians. If it&#39;s mils, it&#39;s obvious how to change it. OK, let&#39;s go...

    1) Have this in your config.cpp - anywhere in the CfgVehicles section:

    ----------
    animated=1;
    class Animations
    {
    class Yaw
    {
    type="rotation";
    animPeriod=0.0000001;
    selection="myselection";
    axis="osa_yaw";
    angle0=0;
    angle1=6.2831853;
    //angle1=6.4<-------- If it&#39;s mils. I&#39;ve yet to find out.
    };
    };
    ----------

    2) Notice that I&#39;ve created a rotation axis called "osa_yaw" and I&#39;ve named the selection I want to rotate about this axis as "myselection". We&#39;ll say that "myselection" is a component part of an object called "myobject". You can call the axis, the selection and, of course, the object whatever you like. You don&#39;t have to learn Czech for custom rotations

    3) Now, here&#39;s the script snippet to control the rotation:

    ----------
    ; Specify desired rotation angle _dir in DEGREES (_dir can be > 360 degrees or < 0 degrees if you like). Then...

    _yaw = abs((_dir % 360) / 360)
    ?(_dir < 0): _yaw = 1 - _yaw
    myobject animate ["Yaw", _yaw]
    ----------

    4) And you&#39;re done

    5) You can set the angle _dir to any specific angle you like - it can be negative - you can incremement or decrement it in a fast loop to get a continuous rotation. Whatever. Up to you.

    Prospero


    Edit:

    I wonder if the two lines...

    _yaw = abs((_dir % 360) / 360)
    ?(_dir < 0): _yaw = 1 - _yaw

    ... could be contracted to one, and without a condition?


    Further edit:

    If you just increment / decrement _dir for infinitely long rotations, ensure _dir doesn&#39;t overflow. To avoid this, reset it to 0 when it&#39;s any multiple of 360, for example.


    Further edit:

    OK, now some of you may be wondering how to get an *accurately timed* rotation *rate* using the above method. Here:

    ----------
    ; Note that _directionrate is in DEGREES PER SECOND.

    _dir = 0
    _directionrate = 45
    _ot = Time
    #lp
    ~0.0001
    _nt = Time
    _dt = (_nt - _ot)
    ?(_dt == 0): goto "lp"
    _yaw = abs((_dir % 360) / 360)
    ?(_dir < 0): _yaw = 1 - _yaw
    myobject animate ["Yaw", _yaw]
    _dir = _dir + _directionrate * _dt
    _ot = _nt
    goto "lp"
    ----------


    Further edit:

    If you define a whole object as the selection to be rotated, you can of course then yaw the object with setDir, and pitch it using a custom animation around a named pitch axis. This gives you the ability to "kinda" set an object&#39;s yaw *and* pitch. Here&#39;s a 2-Axis rate controller script:

    ----------
    _yaw = 0
    _yawrate = 45
    _pitch = 0
    _pitchrate = 90
    _ot = Time
    #lp
    ~0.0001
    _nt = Time
    _dt = (_nt - _ot)
    ?(_dt == 0): goto "lp"
    _ph = abs((_pitch % 360) / 360)
    ?(_pitch < 0): _ph = 1 - _ph
    myobject setdir _yaw
    myobject animate ["Pitch", _ph]
    _yaw = _yaw + _yawrate * _dt
    _pitch = _pitch + _pitchrate * _dt
    _ot = _nt
    goto "lp"
    ----------

    And you would have the following in your config.cpp - again, anywhere in the CfgVehicles section, and this time I&#39;ve called the selection "All". Remember, you have to make and name this selection manually - click & drag a box over the whole thing

    ----------
    animated=1;
    class Animations
    {
    class Pitch
    {
    type="rotation";
    animPeriod=0.0000001;
    selection="All";
    axis="osa_pitch";
    angle0=0;
    angle1=6.2831853;
    };
    };
    ----------


    Further edit:

    Many separate custom rotation axes can be defined on one .p3d model, but sadly, you cannot assign two rotation axes to rotate one selection, although obviously, you can assign several components to one selection. Therefore, you can&#39;t setDir an object&#39;s yaw, then pitch and roll the selection (the selection being the entire object) with two custom axes. Damn shame...

    However, to define two *separate* rotation animations in your config.cpp, you would add this:

    ----------
    animated=1;
    class Animations
    {
    class Rotation1
    {
    type="rotation";
    animPeriod=0.0000001;
    selection="selection1";
    axis="osa_rot1";
    angle0=0;
    angle1=6.2831853;
    };
    class Rotation2
    {
    type="rotation";
    animPeriod=0.0000001;
    selection="selection2";
    axis="osa_rot2";
    angle0=0;
    angle1=6.2831853;
    };
    };
    ----------

    As you can see, I&#39;ve defined the two rotatable selections as "selection1" and "selection2". Remember, you can call these anything you like.


    Further edit:

    It should also be pointed out that you can control ANY selection by manual animation script (as above) - For example, add an entry in the config.cpp for a rotation animation for one of the "reserved" (Czech-named) selections. Just ensure that your script addresses the correct axis & selection. To find out the correct axis and selection names, examine the object&#39;s original MLOD single-player demo .p3d file. Now, if you were to call that object "myobject", then...

    myobject animate ["osa_<something>", <angle>]

    So, say you wanted a cutscene where a technician is testing out an AH-64&#39;s pan/tilt cannon as the helicopter sits on the ground in a hangar. This way you can make that cannon pan and tilt as you want. Well, pan OR tilt. I&#39;m not sure if you can do both at the same time...




  4. #14
    Master Gunnery Sergeant
    Join Date
    Jan 7 2002
    Location
    New Zealand
    Posts
    1,088
    Thanks Prospero
    I&#39;ve managed to get a sort of continuous animation be setting the following:

    animPeriod=10000;
    angle1=360000;

    The only problem is that the animation does stop eventually.
    I&#39;ll try the code you&#39;ve posted.

    I&#39;m using it on a revamped radar station - th old radar addon but using animation rather than &#39;tank&#39; classes. there will only be one model and have the antenna, the radar screen and doors animating.

    Question: I presume the code ***to start the animation is in script form to be called within OFP. Is there any way to have that in the cpp?



    We are now fully operational - that is, we are in a constant flap instead of having isolated confused situations.

    D.I.L.L.I.G.A.F.: Rebel Without a Pause

  5. #15
    </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (Colonel_Klink @ Oct. 19 2002,14:27)</td></tr><tr><td id="QUOTE">Question: I presume the code ***to start the animation is in script form to be called within OFP. Is there any way to have that in the cpp?[/QUOTE]<span id='postcolor'>
    Good question. I believe this may be possible with v1.85, but I haven&#39;t got round to trying it. Perhaps someone else who has could contribute?

    Prospero

  6. #16
    I&#39;m bumping this topic as I added many edits to my last-but-one message here (see above). I suspect that people may find the information useful.

    Prospero.

  7. #17
    Salutations&#33;

    I&#39;d like to be more active in the forum, but unfortunatly, since I don&#39;t play lotto, work will still consume a lot of time. I know everybody works and this is a placebo complain but, since I&#39;m unable to devote some time to projects I want, I felt like snivelering out.... done.

    emptied chest... ***to the point then:

    I was reading that cfgVehicles.hpp when I found this line:
    landingAoa = 10*3.1415/180;

    Assuming that this line is setting a landing Angle of attack of aprox. 10 degrees, we can conclude that rotation unit is radian, since it converts degrees to rad using an aprox pi.

    té mais
    PakoAry

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •