Jump to content
Sign in to follow this  
LizardX

Landing gear - moving direction

Recommended Posts

Good evening,

I'd like to know if someone can change the direction of the gear-retraction. I'm working on the F-105 and its main landing gears should not move towards the front, but to the side! I can find only one parameter (osa leveho/paveho kola), and that's not enough. Thx!

Share this post


Link to post
Share on other sites

Sefe made a "Custom animation for landing gear" tutorial at www.ofpec.com. It explains how to set up a custom landinggear using eventhandlers from 1.85. See that page

Share this post


Link to post
Share on other sites

ggrrrrrrrrooahhh man, I found it! Hope it helps, thanks. And for Sefe, of course.

Share this post


Link to post
Share on other sites

Here's an example of landing gear event coding.

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

gearRetracting= 1;

class Animations

{class Lt outerwing

{type="rotation";

animPeriod=2;

selection="lt outerwing";

axis="lt wing axis";

angle0=0;

angle1=-1.55;};

class Rt outerwing

{type="rotation";

animPeriod=2;

selection="rt outerwing";

axis="rt wing axis";

angle0=0

angle1=1.55;};

class LtGear

{type="rotation";

animPeriod=2;

selection="lt gear";

axis="axis gear lt";

angle0=0;

angle1=-1.55;};

class RtGear

{type="rotation";

animPeriod=2;

selection="rt gear";

axis="axis gear rt";

angle0=0

angle1=-1.55;};

class NoseGear

{type="rotation";

animPeriod=2;

selection="nose gear";

axis="axis gear nose";

angle0=0

angle1=-2.2;};};

class EventHandlers

{gear = "if (_this Select 1) then {(_this Select 0) Animate [""LtGear"", 0]; (_this Select 0) Animate [""RtGear"", 0]; (_this Select 0) Animate [""NoseGear"", 0]} else {(_this Select 0) Animate [""LtGear"", 1]; (_this Select 0) Animate [""RtGear"", 1]; (_this Select 0) Animate [""NoseGear"", 1]}";

foldwing = "if (_this Select 1) then {(_this Select 0) Animate [""Lt outerwing"", 0]; (_this Select 0) Animate [""Rt outerwing"", 0]; else {(_this Select 0) Animate [""Lt outerwing"", 1]; (_this Select 0) Animate [""Rt outerwing"", 1]; }";};<span id='postcolor'>

This lets my plane's landing gear go up and forward(back wheels)/backwards(nose wheels). In the command display I've still got the up and down gear commands, which 100%.

The next event is the wind folding, which I playing with.

DragoFire

Share this post


Link to post
Share on other sites

Which patch do you use? I've got 1.85 and it doesn't work if I put "class Animations" or "class EventHandlers" in the config.cpp.

Share this post


Link to post
Share on other sites

Could you send me a working .cpp please? I'd like to steal your work... biggrin.gif

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (LizardX @ Dec. 09 2002,18:45)</td></tr><tr><td id="QUOTE">Could you send me a working .cpp please? I'd like to steal your work...  biggrin.gif<span id='postcolor'>

Just use the one I posted before. But I'd suggest you delete the lines related to wings.

DragoFire

Share this post


Link to post
Share on other sites

Naah, believe me, it doesn't work. I've tried a lot of things, but "class Animations" and "class EventHandlers" kill the game! It goes dead after the Codemasters logo, without nay error messages. The only way left for me is examining your WORKING files. It could be a syntactical error or something like that. Help!!!

Share this post


Link to post
Share on other sites

Greetings,

I have got the exact same problem when trying this on my plane. Kicks back to desktop after the codemasters logo.

Please send me a working cpp or post one here.

Thanks in advance.

Share this post


Link to post
Share on other sites
Guest BratZ

class Animations

     {

        class LeftGear

        {

           type="rotation";

           animPeriod=2;

           selection="lt gear";

           axis="axis gear left";

           angle0=0

           angle1=-1.46;

        };

        class RightGear

        {

           type="rotation";

           animPeriod=2;

           selection="rt gear";

           axis="axis gear right";

           angle0=0

           angle1=-1.46;

        };

     class EventHandlers

     {

        gear = "if (_this Select 1) then {(_this Select 0) Animate [""LeftGear"", 0]; (_this Select 0) Animate [""RightGear"", 0]} else {(_this Select 0) Animate [""LeftGear"", 1]; (_this Select 0) Animate [""RightGear"", 1]}";

     };

};

This folds in the 2 front gear on my plane using the gear eventhandler ,which actually automatically lifts the gear upon takeoff,no other scripting necessary,to not have it automatic,just use useractions instead because I am having a problem of them lifting too soon

This method is basically using "Sefe's Method"

edit: actually I upped the animation period on mine,that should help

Share this post


Link to post
Share on other sites
Guest BratZ

//

// Curtiss SB2C Helldiver by BraTTy

// Beta version.

#define TEast 0

#define TWest 1

#define TGuerrila 2

#define TCivilian 3

#define TSideUnknown 4

#define TEnemy 5

#define TFriendly 6

#define TLogic 7

#define true 1

#define false 0

#define private 0

#define protected 1

#define public 2

class CfgPatches

{

class BrtSB2CAA

{

units[] = {"BrtSB2CAA"};

weapons[] = {};

requiredVersion = 1.85;

};

       

};

class CfgVehicles

{

       class All{};

       class AllVehicles:All{};

class Air: AllVehicles {};

class Plane: Air {};

class A10: Plane {};

class BrtSB2CAA: A10

{

scope=public;

crew = "SoldierWPilot";

               side = 1;

displayName="Curtiss SB2C Helldiver US Navy";

driverAction = ManActCessnaCargo;

               typicalCargo[]={Soldier, SoldierLAW};

               driverCanSee = CanSeeEye+CanSeeEar;

               gunnerCanSee = CanSeeEye+CanSeeEar;

accuracy=0.40;

vehicleClass = "BraTTy WW2 Warplanes";

               extCameraPosition[] = {0,0,-12};

               castdrivershadow= 1;

armor=27;

               cost=200000;

               landingSpeed=105;

               maxSpeed = 487;

               landingAoa="3.5*3.1415/180";

flapsFrictionCoef=2.2;

model="\Brt_SB2c\BrtSB2C.p3d";

               type="VAir";

//threat[] VSoft, VArmor, VAir

               threat[]={0.100000,0.1,0.100000};

aileronSensitivity = 0.3;

elevatorSensitivity = 0.25;

gearRetracting = true;

ejectSpeed[]={0,0,0};

fov=0.6;

               preferRoads=false;

               formationX=20;

formationZ=30;

               //driverCanSee="2+8";

              fuelCapacity=160;

noseDownCoef = 0.7;

precision=60;

brakeDistance=50;

               hasGunner=true;

               ejectDeadCargo=1;

weapons[]={Browning};

magazines[]={Browning};

               //minGunElev=-0; // default - fixed gun

//maxGunElev=+60;

//minGunTurn=-60;

//maxGunTurn=+60;

               hiddenSelections[]={"wingtips","wingtips1"};

transportsoldier=0;

transportAmmo=0;

               camouflage=8

               audible=6;

               gunnerAction=ManActCessnaCargo;

               cargoIsCoDriver[]={0,0};

               soundEngine[]={Vehicles\plane,db3,.6};

soundEnviron[]={Objects\noise,db-10,1.0};

soundServo[]={Vehicles\gun_elevate,db-20,0.4};

               animated=1;

               class ViewPilot

{

initFov=0.600000;

minFov=0.400000;

maxFov=0.850000;

initAngleX=0;

minAngleX=-75;

maxAngleX=50;

initAngleY=0;

minAngleY=-150;

maxAngleY=150;

};

class ViewOptics

{

initAngleX=0;

minAngleX=0;

maxAngleX=0;

initAngleY=0;

minAngleY=0;

maxAngleY=0;

initFov=0.500000;

minFov=0.500000;

maxFov=0.500000;

};

class ViewGunner

{

initAngleX=5;

minAngleX=-85;

maxAngleX=30;

initAngleY=0;

minAngleY=-120;

maxAngleY=120;

initFov=0.700000;

minFov=0.400000;

maxFov=0.850000;

};

class IndicatorSpeed

{

selection = "mph";

axis = "osa_mph";

angle = -360;

min = 0;

max = 117;

};

class IndicatorVertSpeed

{

selection = "vert_speed";

axis = "osa_vert_speed";

angle = -180;

min = -5;

max = 5;

};

class IndicatorAltRadar

{

selection="alt";

axis="osa_alt";

angle=360;

min=0;

max=180;

};

class IndicatorCompass

{

selection="kompas";

axis="osa_kompas";

angle=360;

min=-3.141593;

max=3.141593;

};

class IndicatorRPM

{

selection="rpm";

axis="osa_rpm";

angle=340;

min=0;

max=-1;

};                      

     class Animations

     {

        class LeftGear

        {

           type="rotation";

           animPeriod=10;

           selection="lt gear";

           axis="axis gear left";

           angle0=0

           angle1=-1.46;

        };

        class RightGear

        {

           type="rotation";

           animPeriod=10;

           selection="rt gear";

           axis="axis gear right";

           angle0=0

           angle1=-1.46;

        };

    class foldwings1

    {

       type="rotation";

       animPeriod=5;

       selection="wingtipr";

       axis="wingaxisr";

       angle0=0;

       angle1=2.23;

    };

class foldwings1g

    {

       type="rotation";

       animPeriod=5;

       selection="component08";

       axis="wingaxisr";

       angle0=0;

       angle1=2.23;

    };

   class foldwings

    {

       type="rotation";

       animPeriod=5;

       selection="wingtipl";

       axis="wingaxisl";

       angle0=0;

       angle1=-2.23;

    };

 class foldwingsg

    {

       type="rotation";

       animPeriod=5;

       selection="component07";

       axis="wingaxisl";

       angle0=0;

       angle1=-2.23;

    };

     class rcanopya

    {

       type="rotation";

       animPeriod=3;

       selection="rcanopy";

       axis="osa axis rcanopy";

       angle0=0;

       angle1=.02;

    };

 class fcanopya

    {

       type="rotation";

       animPeriod=3;

       selection="fcanopy";

       axis="osa axis fcanopy";

       angle0=0;

       angle1=-.0103;

    };

class bbayla

    {

       type="rotation";

       animPeriod=3;

       selection="bbayl";

       axis="osa axis bbayl";

       angle0=0;

       angle1=-1.8;

    };

class bbayra

    {

       type="rotation";

       animPeriod=3;

       selection="bbayr";

       axis="osa axis bbayr";

       angle0=0;

       angle1=1.8;

    };

};

class UserActions

{

//Fold and Unfold Wings from pilot's seats

class FoldWingsU

{

displayName="UnFold Wings";

position="wingtipr";

radius=55

condition="this animationPhase ""foldwings"" >= 0.5 and driver this == player";

statement="this animate [""foldwings"", 0];this animate [""foldwings1"", 0];this setObjectTexture [0,""\Brt_Sb2c\clear_empty.paa""];this setObjectTexture [1,""\Brt_Sb2c\hellcattex.paa""];this animate [""foldwingsg"", 0];this animate [""foldwings1g"", 0]";

};

class HideWingsU

{

displayName="Hide Wings";

position="wingtipr";

radius=55

condition="this animationPhase ""foldwings"" >= 0.5 and driver this == player";

statement="this setObjectTexture [0,""\data\clear_empty.paa""]";

};

class FoldWingsD

{

displayName="Fold Wings";

position="wingtipr";

radius=55

condition="this animationPhase ""foldwings"" < 0.5 and getpos this select 2 < 1 and driver this == player ";

statement="this setObjectTexture [0,""\Brt_Sb2c\hellcattex.paa""];this setObjectTexture [1,""\Brt_Sb2c\clear_empty.paa""];this animate [""foldwings"", 1];this animate [""foldwings1"", 1];this animate [""foldwingsg"", 1];this animate [""foldwings1g"", 1]";

};

class RcanopyO

{

displayName="Open R Canopy";

position="rcanopy";

radius=50

condition="this animationPhase ""rcanopya"" < 0.03 and  gunner this == player";

//condition="this animationPhase ""rcanopya"" < 0.03 and player in this ";

statement="this animate [""rcanopya"", 1]";

};

class RcanopyC

{

displayName="Close R Canopy";

position="rcanopy";

radius=50

condition="this animationPhase ""rcanopya"" >= .03 and gunner this == player";

statement="this animate [""rcanopya"", 0]";

};

class FcanopyO

{

displayName="Open F Canopy";

position="Fcanopy";

radius=50

condition="this animationPhase ""fcanopya"" < 0.03 and driver this == player ";

statement="this animate [""fcanopya"", 1]";

};

class FcanopyC

{

displayName="Close F Canopy";

position="fcanopy";

radius=50

condition="this animationPhase ""fcanopya"" >= .03 and driver this == player ";

statement="this animate [""fcanopya"", 0]";

};

class BbayOpen

{

displayName="Open Bomb Bay";

position="bbayl";

radius=50

condition="this animationPhase ""bbayla"" < 0.5 and driver this == player";

statement="this animate [""bbayla"", 1];this animate [""bbayra"", 1]";

};

class BbayClose

{

displayName="Close Bomb Bay";

position="bbayl";

radius=50

condition="this animationPhase ""bbayla"" >= 0.5 and driver this == player";

statement="this animate [""bbayla"", 0];this animate [""bbayra"", 0]";

};

};

     class EventHandlers

     {

        gear = "if (_this Select 1) then {(_this Select 0) Animate [""LeftGear"", 0]; (_this Select 0) Animate [""RightGear"", 0]} else {(_this Select 0) Animate [""LeftGear"", 1]; (_this Select 0) Animate [""RightGear"", 1]}";

     };

};

};

class Cfgmodels

{

class Default {};

class Plane: Default{};

class BrtSB2CAA: Plane

{

sectionsInherit="Vehicle";

sections[]={"wingtips","vrtule staticka","vrtule blur"};

};

};

};

Currently working on bombs and textures,so not all done ,But hereya

edit: I change some of my names in case anyone cuts and pastes this and release an addon.people wont have conflicts with my plane

Share this post


Link to post
Share on other sites

Good news for me hehe, ofp doesnt crash anymore after entering event handler in my cpp.

Bad news is the damn thing wont retract. =(

My complete cpp is the following:

****************************************

#define TEast 0

#define TWest 1

#define TGuerrila 2

#define TCivilian 3

#define TSideUnknown 4

#define TEnemy 5

#define TFriendly 6

#define TLogic 7

#define true 1

#define false 0

// type scope

#define private 0

#define protected 1

#define public 2

class CfgPatches

{

class xxx

{

units[] = {xxx};

weapons[] = {};

requiredVersion = 1.40;

};

class Mav

{

units[] = {};

weapons[] = {Mav};

requiredVersion = 1.40;

};

};

class CfgAmmo

{

class Default {};

class AT3: Default {};

class CarlGustav: AT3 {};

class AA : CarlGustav {};

class Mav : AA

{

proxyShape="\xxx\Mav";

reloadTime=1.0;

maneuvrability=15.0;

irLock=true;

airLock=false;

laserLock=false;

initTime=0.5;

maxleadspeed=4000;

ThrustTime=5.5;

visibleFire=40;

audibleFire=32;

visibleFireTime=50;

minRange=200;minRangeProbab=0.75;

midRange=600;midRangeProbab=0.95;

maxRange=2000;maxRangeProbab=0.75;

maxControlRange=2000;

thrust=700;

maxSpeed=700;

hit=1900;

indirectHit=800;

indirectHitRange=5;

model = "\xxx\Mav";

};

};

class CfgWeapons

{

class Default {};

class LAWLauncher: Default {};

class CarlGustavLauncher : LAWLauncher {};

class AT3Launcher: CarlGustavLauncher {};

class HellfireLauncher: AT3Launcher {};

class MaverickLauncher: HellfireLauncher {};

class Mav: MaverickLauncher

{

ammo=Mav;

displayName="AGM-114a";

displayNameMagazine="AGM-114a";

shortNameMagazine="AGM-114a";

count=2;

initspeed=15;

sound[]={Weapons\rocketflying,db-10,1};

model = "\xxx\Mav";

canLock=2;

};

};

class CfgVehicles

{

class All {};

class AllVehicles: All {};

class Air: AllVehicles {};

class Plane: Air {};

class xxx : Plane

{

scope=public;

crew = SoldierWPilot;

side = TWest;

displayName="xxx xxx";

accuracy=0.30;

maneuvrability=50.0;

camouflage=0;

audible = 1;

irScanRange = 400000;

irTarget = 1;

irScanGround=1;

laserScanner = 1;

nightVision=1;

driverAction = ManActA10Pilot;

driveriscommander=1;

hasGunner=true;

maxSpeed = 216;

gearRetracting = true;

nameSound="plane";

soundEngine[]={"Vehicles\plane",db-10,1}; // Cessna sound

soundEnviron[]={"Objects\noise",db-60,1.0}; // Cessna sound

soundServo[]={"Vehicles\gun_elevate",db-40,0.4}; // Cessna sound

aileronSensitivity = .8; // relative aileron sensitivity

elevatorSensitivity = .8; // relative elevator sensitivity

noseDownCoef = .3; // how much goes nose down during turns

landingAoa="3.5*3.1415/180"; // vehicle movement precision

flapsFrictionCoef=2;

steerAheadSimul=1.0;

steerAheadPlan=2.0;

gunnerAction = ManActUH60Gunner

gunnerOpticsModel="optika_zsu_gunner";

weapons[]={mav};

magazines[]={mav,};

armor=40;

cost=200000;

model="\xxx\xxx";

fov=0.5;

animated=1;

type=VAir;

//threat[] VSoft, VArmor, VAir

threat[]={0.1, 0.8, 1.0};

};

};

class Animations

{

class LeftGear

{

type="rotation";

animPeriod=2;

selection="left gear";

axis="axis gear left";

angle0=0

angle1=1.55;

};

class RightGear

{

type="rotation";

animPeriod=2;

selection="right gear";

axis="axis gear right";

angle0=0

angle1=-1.55;

};

class NoseGear

{

type="rotation";

animPeriod=2;

selection="nose gear";

axis="axis nose gear";

angle0=0

angle1=2.2;

};

class EventHandlers

{

gear = "if (_this Select 1) then {(_this Select 0) Animate [""LeftGear"", 0]; (_this Select 0) Animate [""RightGear"", 0]; (_this Select 0) Animate [""NoseGear"", 0]} else {(_this Select 0) Animate [""LeftGear"", 1]; (_this Select 0) Animate [""RightGear"", 1]; (_this Select 0) Animate [""NoseGear"", 1]}";

};

class CfgNonAIVehicles

{

class ProxyWeapon {};

class ProxyMav : ProxyWeapon {model = "\xxx\Mav.p3d"; simulation = "maverickweapon";}

};

****************************************

I carefully checked and renamed all the groups and axis in o2. Checked for spaces at the start and end of the names and all of that.

Hope you can help some more wink.gif

Thanks in advance

Share this post


Link to post
Share on other sites
Guest BratZ

Get this ,I move some axis that were causing my plane to be at -1 altitude and now the gear don't fold up by itself.

It was folding automatically when the plane hit 0 or above.

Now I have to fold it ,which is the way it should be

So "Gear Up" isn't showing for you?

Or you mean its not automatic?

In O2 looks like you only need selections...Left gear,Right Gear and Nose Gear in view lods?

And 3 axis defined in memory lod?

Also try taking out one or both of these brackets as animations is a definition of cfgvehicles

}; <------This

}; <---- This

class Animations

And try adding one before class eventhandlers

Share this post


Link to post
Share on other sites

Eureka its alive, alive!!!

Woohooooooooooooo lol

1 tiny detail tho, when i start the plane in the air it starts with gears down. AI retracts the gear just fine after takeoff tho. I understand why i think, but is there a workaround?

Great thanks sofar btw Bratz, you helped me allot already =)

Share this post


Link to post
Share on other sites
Guest BratZ

No Problem,glad I could help

I have heard of the start in air gear problem and it doesnt make sense,as soon as you pick landing autopilot ai will raise or lower gear (raise if your in the air and not needed)

Apparantly my Helldiver must have the same problem,i actually haven't tried.we will see what we can do about that

Share this post


Link to post
Share on other sites

Presumably, this code will work with helicopters too?

Share this post


Link to post
Share on other sites
Guest BratZ

Not using the gear eventhandler I don't think,but certainly by making it a useraction

Share this post


Link to post
Share on other sites

On second thought, nevermind that question, just remembered Col. Klinks tutorial on helicopter landing gear...

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  

×