Results 1 to 2 of 2

Thread: Scripted rotations... getting there...

  1. #1
    Hi all,

    I've been trying to create objects whose pitch and roll can be set via script. As we all know, you can set the yaw (or direction) via a setDir, but you can't do the same for pitch and roll.

    Well, I'm halfway there! To explain...

    I was messing around with Zwadar's openable gate model, as he uses one axis of rotation animation to raise and lower the gate arm. I modified the config.cpp to look like this:

    ----------
    class CfgPatches
    {
    class kkb_gate
    {
    units[] = {"kkb_gate"};
    weapons[] = {};
    requiredVersion = 1.75;
    };
    };
    class CfgModels
    {
    class Default { };
    class kkb_gate: Default
    {
    sections[]={"arm"};
    sectionsInherit="";
    };
    };
    class CfgVehicles
    {
    class All {};
    class Static: All {};
    class Building: Static {};
    class NonStrategic: Building {};
    class Fence: NonStrategic {};
    class kkb_gate_dummy: Fence
    {
    accuracy=1.000;
    scope=0;
    vehicleClass="Objects";
    model="\kkb_gate\kkb_gate.p3d";
    displayName="Gate";
    destrType=destructtree;
    cost=100;
    icon="\kkb_gate\kkb_gate.paa";
    };
    class kkb_gate:kkb_gate_dummy
    {
    Scope=2;
    accuracy=1000;
    displayName="KKB Gate";
    animated=1;
    class Animations
    {
    class roll
    {
    type="rotation";
    animPeriod=0.0000001;
    selection="arm";
    axis="osa_roll";
    angle0=0;
    angle1=6.284;
    };
    class pitch
    {
    type="rotation";
    animPeriod=0.0000001;
    selection="arm";
    axis="osa_pitch";
    angle0=0;
    angle1=6.284;
    };
    };
    };
    };
    ----------

    I then modified the .p3d by adding a second axis of rotation (by adding two vertices to form the axis in the appropriate place), and as you can see, I've called these axes "osa_roll" and "osa_pitch". Both are set to operate on the selection "arm".

    Now, in my script, I can use the following commands to set the roll and pitch of the gate arm:

    mygate animate ["pitch", _a]
    mygate animate ["roll", _b]

    ...where mygate is the name I've assigned to the gate, and _a and _b are values between 0 and 1. Going from 0 to 1 gives you one full 360 rotation.

    Well, it half works. If I use the config .cpp exactly as quoted above, the pitch will work but the roll won't. If I simply then swap the order in which the animations are written in the config.cpp, the roll will work but the pitch won't!

    Any ideas chaps?

    Prospero




  2. #2
    Guest
    What was wrong with this thread?
    http://www.flashpoint1985.com/cgi-bin....otation

Posting Permissions

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