Beispiel #1
0
        void UpdateAttachedParticleSystem()
        {
            float factor = CalculateVelocityCoefficient();

            foreach (MapObjectAttachedObject attachedObject in AttachedObjects)
            {
                MapObjectAttachedParticle attachedParticleObject = attachedObject as MapObjectAttachedParticle;
                if (attachedParticleObject != null)
                {
                    ParticleSystem particleSystem       = attachedParticleObject.ParticleSystem;
                    ParticleSystem sourceParticleSystem = attachedParticleObject.SourceParticleSystem;

                    if (particleSystem != null && sourceParticleSystem != null)
                    {
                        for (int n = 0; n < particleSystem.Emitters.Length; n++)
                        {
                            ParticleEmitter emitter       = particleSystem.Emitters[n];
                            ParticleEmitter sourceEmitter = sourceParticleSystem.Emitters[n];

                            emitter.ParticleVelocity = factor * sourceEmitter.ParticleVelocity;

                            if (factor > 0.05f)
                            {
                                emitter.EmissionRate = factor * sourceEmitter.EmissionRate;
                            }
                            else
                            {
                                emitter.EmissionRate = 0;
                            }
                        }
                    }
                }
            }
        }
Beispiel #2
0
        private void ShiftBooster()
        {
            MapObjectAttachedParticle NOS1 = GetFirstAttachedObjectByAlias("NOS1") as MapObjectAttachedParticle;
            MapObjectAttachedParticle NOS2 = GetFirstAttachedObjectByAlias("NOS2") as MapObjectAttachedParticle;

            bool boosted = false;

            if (Intellect.IsControlKeyPressed(GameControlKeys.Shift))
            {
                if (Type.NOSBottel >= 5)
                {
                    boosted         = true;
                    NOSBoost        = 50;
                    Type.NOSBottel -= 0.5f;
                }
                else
                {
                    NOSBoost = 0;
                }
            }
            else
            {
                NOSBoost = 0;
                if (Type.NOSBottel < 100)
                {
                    Type.NOSBottel += 0.05f;
                }
            }
            if (NOS1 != null)
            {
                NOS1.Visible = boosted;
                NOS2.Visible = boosted;
            }
        }
Beispiel #3
0
        private void JetEngineBooster()
        {
            MapObjectAttachedParticle ENBoosterParticle1 = GetFirstAttachedObjectByAlias("ENBoosterParticle1") as MapObjectAttachedParticle;
            MapObjectAttachedParticle ENBoosterParticle2 = GetFirstAttachedObjectByAlias("ENBoosterParticle2") as MapObjectAttachedParticle;

            bool BEngBoosterON = false;

            if (Intellect.IsControlKeyPressed(GameControlKeys.SHIFT))
            {
                if (ENGFuel >= 5)
                {
                    AKJetBody.AddForce(ForceType.GlobalAtLocalPos, TickDelta,
                                       AKJetBody.Rotation * new Vec3(40, 0, 0) * MASS, Vec3.Zero);
                    ENGFuel      -= 0.5f;
                    BEngBoosterON = true;
                }
            }
            else
            {
                BEngBoosterON = false;
                if (ENGFuel < Type.ENGBoosterFuelCapacity)
                {
                    ENGFuel += 0.05f;
                }
            }
            if (ENBoosterParticle1 != null)
            {
                ENBoosterParticle1.Visible = BEngBoosterON;
                ENBoosterParticle2.Visible = BEngBoosterON;
            }
        }
Beispiel #4
0
        private void ShiftBooster()
        {
            MapObjectAttachedParticle Shift1 = GetFirstAttachedObjectByAlias("Shift1") as MapObjectAttachedParticle;
            MapObjectAttachedParticle Shift2 = GetFirstAttachedObjectByAlias("Shift2") as MapObjectAttachedParticle;

            bool boosted = false;

            if (Intellect.IsControlKeyPressed(GameControlKeys.SHIFT))
            {
                if (ShiftBottel >= 5)
                {
                    AKVTOLBody.AddForce(ForceType.GlobalAtLocalPos, TickDelta,
                                        AKVTOLBody.Rotation * new Vec3(40, 0, 0) * MASS, Vec3.Zero);
                    ShiftBottel -= 0.5f;
                    boosted      = true;
                }
            }
            else
            {
                boosted = false;
                if (ShiftBottel < Type.MaxShiftBottel)
                {
                    ShiftBottel += 0.05f;
                }
            }

            if (Shift1 != null)
            {
                Shift1.Visible = boosted;
            }
            if (Shift2 != null)
            {
                Shift2.Visible = boosted;
            }
        }
Beispiel #5
0
        /// <summary>Overridden from <see cref="Engine.EntitySystem.Entity.OnPostCreate(Boolean)"/>.</summary>
        protected override void OnPostCreate2(bool loaded)
        {
            base.OnPostCreate2(loaded);

            //We has initialization into OnPostCreate2, because we need to intialize after
            //parent entity initialized (Dynamic.OnPostCreate). It's need for world serialization.

            SubscribeToTickEvent();

            Dynamic parent = (Dynamic)Parent;

            bool existsAttachedObjects = false;

            //show attached objects for this influence
            foreach (MapObjectAttachedObject attachedObject in parent.AttachedObjects)
            {
                if (attachedObject.Alias == Type.Name)
                {
                    attachedObject.Visible = true;
                    existsAttachedObjects  = true;
                }
            }

            if (!existsAttachedObjects)
            {
                //create default particle system
                if (!string.IsNullOrEmpty(Type.DefaultParticleName))
                {
                    defaultAttachedParticle = new MapObjectAttachedParticle();
                    defaultAttachedParticle.ParticleName = Type.DefaultParticleName;
                    parent.Attach(defaultAttachedParticle);
                }
            }
        }
        void UpdateMode()
        {
            PhysicalStreamType.Mode mode = alternativeMode ? Type.AlternativeMode : Type.NormalMode;

            if (region != null)
            {
                region.DamagePerSecond        = mode.DamagePerSecond;
                region.InfluenceType          = mode.InfluenceType;
                region.InfluenceTimePerSecond = mode.InfluenceTimePerSecond;
            }

            if (modeAttachedParticle != null)
            {
                Detach(modeAttachedParticle);
                modeAttachedParticle = null;
            }

            if (!string.IsNullOrEmpty(mode.ParticleName))
            {
                modeAttachedParticle = new MapObjectAttachedParticle();
                modeAttachedParticle.ParticleName  = mode.ParticleName;
                modeAttachedParticle.OwnerRotation = true;
                Attach(modeAttachedParticle);
            }
        }
Beispiel #7
0
        protected override void OnPostCreate(bool loaded)
        {
            base.OnPostCreate(loaded);
            AddTimer();
            bool existsAttachedObjects = false;

            //show attached objects for this influence
            foreach (MapObjectAttachedObject attachedObject in this.AttachedObjects)
            {
                if (attachedObject.Alias == Type.Name)
                {
                    attachedObject.Visible = true;
                    existsAttachedObjects  = true;
                }
            }

            if (!existsAttachedObjects)
            {
                //create default particle system
                if (!string.IsNullOrEmpty(Type.DefaultParticleName))
                {
                    defaultAttachedParticle = new MapObjectAttachedParticle();
                    defaultAttachedParticle.ParticleName = Type.DefaultParticleName;
                    this.Attach(defaultAttachedParticle);
                    defaultAttachedParticle.PositionOffset = this.Type.ParticlePosition;
                }
            }
        }
Beispiel #8
0
 void UpdateParticlesForceCoefficient(float forceCoefficient)
 {
     //Set ForceCoefficient to particles
     foreach (MapObjectAttachedObject attachedObject in AttachedObjects)
     {
         MapObjectAttachedParticle attachedParticleObject =
             attachedObject as MapObjectAttachedParticle;
         if (attachedParticleObject != null)
         {
             attachedParticleObject.ForceCoefficient = forceCoefficient;
         }
     }
 }
Beispiel #9
0
        private void Ñar_particle()
        {
            float carspeed = GetWheelsSpeed();

            MapObjectAttachedParticle Carspeed_applyparticle1 = GetAttachedObjectByAlias("Carspeed_applyparticle1") as MapObjectAttachedParticle;
            MapObjectAttachedParticle Carspeed_applyparticle2 = GetAttachedObjectByAlias("Carspeed_applyparticle2") as MapObjectAttachedParticle;

            bool  Hs1      = false;
            bool  Cp1      = false;
            float speed_cp = GetWheelsSpeed();
            bool  on_whell = LRWheel.onGround || RRWheel.onGround;

            if (speed_cp > Type.Carspeed_applyparticle & on_whell)
            {
                Cp1 = true;
            }
            float ang  = chassisBody.AngularVelocity.Z;
            float ang2 = ang * carspeed * 2;

            if (carspeed > 20)
            {
                ang2 = ang * carspeed / 2;
            }
            else if (carspeed > 50)
            {
                ang2 = ang * carspeed / 10;
            }
            if (Intellect.IsControlKeyPressed(GameControlKeys.Jump))
            {
                skidsound(true);
                //EngineApp.Instance.ScreenGuiRenderer.AddText("ang: " + ang2, new Vec2(.6f, .4f));
                if (carspeed > 10 & on_whell)
                {
                    Hs1 = true;
                    chassisBody.AngularDamping = 0;
                }
            }
            else
            {
                //dumpings
                chassisBody.AngularDamping = 3;
            }

            Carspeed_applyparticle1.Visible = Hs1;
            Carspeed_applyparticle2.Visible = Cp1;
        }
Beispiel #10
0
        /// <summary>Overridden from <see cref="Engine.EntitySystem.Entity.OnDestroy()"/>.</summary>
        protected override void OnDestroy()
        {
            Dynamic parent = (Dynamic)Parent;

            //hide attached objects for this influence
            foreach( MapObjectAttachedObject attachedObject in parent.AttachedObjects )
            {
                if( attachedObject.Alias == Type.Name )
                    attachedObject.Visible = false;
            }

            //destroy default particle system
            if( defaultAttachedParticle != null )
            {
                parent.Detach( defaultAttachedParticle );
                defaultAttachedParticle = null;
            }

            base.OnDestroy();
        }
Beispiel #11
0
        /// <summary>Overridden from <see cref="Engine.EntitySystem.Entity.OnDestroy()"/>.</summary>
        protected override void OnDestroy()
        {
            Dynamic parent = (Dynamic)Parent;

            //hide attached objects for this influence
            foreach (MapObjectAttachedObject attachedObject in parent.AttachedObjects)
            {
                if (attachedObject.Alias == Type.Name)
                {
                    attachedObject.Visible = false;
                }
            }

            //destroy default particle system
            if (defaultAttachedParticle != null)
            {
                parent.Detach(defaultAttachedParticle);
                defaultAttachedParticle = null;
            }

            base.OnDestroy();
        }
Beispiel #12
0
        /// <summary>Overridden from <see cref="Engine.EntitySystem.Entity.OnPostCreate(Boolean)"/>.</summary>
        protected override void OnPostCreate2( bool loaded )
        {
            base.OnPostCreate2( loaded );

            //We has initialization into OnPostCreate2, because we need to intialize after
            //parent entity initialized (Dynamic.OnPostCreate). It's need for world serialization.

            AddTimer();

            Dynamic parent = (Dynamic)Parent;

            bool existsAttachedObjects = false;

            //show attached objects for this influence
            foreach( MapObjectAttachedObject attachedObject in parent.AttachedObjects )
            {
                if( attachedObject.Alias == Type.Name )
                {
                    attachedObject.Visible = true;
                    existsAttachedObjects = true;
                }
            }

            if( !existsAttachedObjects )
            {
                //create default particle system
                if( !string.IsNullOrEmpty( Type.DefaultParticleName ) )
                {
                    defaultAttachedParticle = new MapObjectAttachedParticle();
                    defaultAttachedParticle.ParticleName = Type.DefaultParticleName;
                    parent.Attach( defaultAttachedParticle );
                }
            }
        }
        private void UpdateMode()
        {
            PhysicalStreamType.Mode mode = alternativeMode ? Type.AlternativeMode : Type.NormalMode;

            if (region != null)
            {
                region.DamagePerSecond = mode.DamagePerSecond;
                region.InfluenceType = mode.InfluenceType;
                region.InfluenceTimePerSecond = mode.InfluenceTimePerSecond;
            }

            if (modeAttachedParticle != null)
            {
                Detach(modeAttachedParticle);
                modeAttachedParticle = null;
            }

            if (!string.IsNullOrEmpty(mode.ParticleName))
            {
                modeAttachedParticle = new MapObjectAttachedParticle();
                modeAttachedParticle.ParticleName = mode.ParticleName;
                modeAttachedParticle.OwnerRotation = true;
                Attach(modeAttachedParticle);
            }
        }
Beispiel #14
0
        private void TickIntellect()
        {
            //GUItest();
            JetEngineBooster();

            VSI = AKJetBody.LinearVelocity.Z - (AKJetBody.LinearVelocity.Z % 1);
            float speed = GetRealSpeed();
            float ControlersRatio;

            MapObjectAttachedParticle ENBoosterParticle2 = GetFirstAttachedObjectByAlias("JetFire") as MapObjectAttachedParticle;
            AKunit akunit = GetPlayerUnit() as AKunit;

            Vec3 dir = AKJetBody.Rotation.GetForward();

            AKJetOn = Intellect != null && Intellect.IsActive();

            MASS = 0;
            foreach (Body body in PhysicsModel.Bodies)
            {
                MASS += body.Mass;
            }

            // controlers Ratio
            if (speed > 0)
            {
                ControlersRatio = speed / 80;
                if (ControlersRatio > 1)
                {
                    ControlersRatio = 1;
                }
            }
            else
            {
                ControlersRatio = 0;
            }
            // controlers Ratio

            //////////////////////// WING WING WING WING WING WING WING WING WING WING WING /////////////////////////////////
            //wing General
            Angles BodyAngles = Rotation.GetInverse().ToAngles();

            float normalizeRoll = BodyAngles.Roll;

            if (normalizeRoll < 0)
            {
                normalizeRoll = -normalizeRoll;
            }

            float PitchUp = -BodyAngles.Pitch;

            if (PitchUp < 0)
            {
                PitchUp = 0;
            }

            if (PitchUp > 90)
            {
                PitchUp = 90 - (PitchUp - 90);
            }

            float PitchDown = BodyAngles.Pitch;

            if (PitchDown < 0)
            {
                PitchDown = 0;
            }

            if (PitchDown > 90)
            {
                PitchDown = 90 - (PitchDown - 90);
            }

            //End of Wing GENERAL

            //Wing Anti Gravity Force & Stall
            float WingUpForce;

            if (speed < 40f)
            {
                //stall
                if (VSI < 0 && PitchUp > 35f)
                {
                    Stall = true;
                }
                else
                {
                    Stall = false;
                }

                //force
                WingUpForce = ((speed / 4f) - 0.2f);
            }
            else if (speed > 40f)
            {
                WingUpForce = -PhysicsWorld.Instance.MainScene.Gravity.Z;
                //WingUpForce = 9.8f; //TODO:Incin change to map gravity
            }
            else
            {
                WingUpForce = 0;
            }

            //antigrav
            AKJetBody.AddForce(ForceType.GlobalAtLocalPos, TickDelta,
                               AKJetBody.Rotation * new Vec3(0, 0, WingUpForce) * MASS, Vec3.Zero);

            //antivelo
            AKJetBody.AddForce(ForceType.GlobalAtLocalPos, TickDelta,
                               AKJetBody.Rotation * new Vec3((-WingUpForce * PitchUp / 9) / 4, 0, 0) * MASS, Vec3.Zero);

            //END oF Wing Anit Gravity Force & Stall
            //Wing Decenging Force

            float DecendSpeedForce;

            if (VSI < 0 && PitchUp == 0)
            {
                DecendSpeedForce = (180 - normalizeRoll) + PitchDown;

                AKJetBody.AddForce(ForceType.GlobalAtLocalPos, TickDelta,
                                   AKJetBody.Rotation * new Vec3(DecendSpeedForce / 20, 0, 0) * MASS, Vec3.Zero);
            }

            //End of Wing Decenging Force
            /////// END END END ///OF OF OF/// WING WING WING WING WING WING WING WING WING WING WING //////////////////////////////

            //engine force + sound pitch control
            if (Intellect.IsControlKeyPressed(GameControlKeys.Jump))
            {
                if (akunit != null)
                {
                    akunit.GunsTryFire(false);
                }
            }

            if (Intellect.IsControlKeyPressed(GameControlKeys.Forward))
            {
                force += forceadd;
            }
            if (Intellect.IsControlKeyPressed(GameControlKeys.Backward))
            {
                force -= forceadd;
            }

            if (ENBoosterParticle2 != null)
            {
                if (force > 85f)
                {
                    ENBoosterParticle2.Visible = true;
                }
                else
                {
                    ENBoosterParticle2.Visible = false;
                }
            }

            enpitch = (force / 80f);
            MathFunctions.Clamp(ref force, 0.1f, 100);
            MathFunctions.Clamp(ref enpitch, 0.8f, 1.3f);

            //update jet channel position and pitch
            if (rotorSoundChannel != null)
            {
                //update channel
                rotorSoundChannel.Pitch    = enpitch;
                rotorSoundChannel.Volume   = 1;
                rotorSoundChannel.Position = Position;
                //rotorSoundChannel.MinDistance = 10;
            }

            //end of engine force + sound pitch control

            //Forces
            ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

            //start jet Pitch (Y turn)
            if (Intellect.IsControlKeyPressed(GameControlKeys.Arrow_Up) || Intellect.IsControlKeyPressed(GameControlKeys.Arrow_Down))
            {
                float AUp   = Intellect.GetControlKeyStrength(GameControlKeys.Arrow_Up) / 2;
                float ADown = Intellect.GetControlKeyStrength(GameControlKeys.Arrow_Down) / 2;
                Hpitch += (AUp - ADown);
                MathFunctions.Clamp(ref Hpitch, -10, 10);
            }
            else
            {
                if (Hpitch != 0)
                {
                    Hpitch -= Hpitch / 5;

                    if ((Hpitch - (Hpitch % 1)) == 0)
                    {
                        Hpitch = 0;
                    }
                }
                else
                {
                    float mammadpitch = (AKJetBody.AngularVelocity * AKJetBody.Rotation.GetInverse()).Y * 2;

                    MathFunctions.Clamp(ref mammadpitch, -10f, 10);
                    AKJetBody.AddForce(ForceType.GlobalAtLocalPos, TickDelta,
                                       AKJetBody.Rotation * new Vec3(0, 0, -mammadpitch) * MASS, new Vec3(-8, 0, 0));
                }
            }

            if (Hpitch != 0)
            {
                AKJetBody.AddForce(ForceType.GlobalTorque, TickDelta,
                                   AKJetBody.Rotation * new Vec3(0, ((Hpitch) * ControlersRatio), 0) * MASS, Vec3.Zero);
            }
            //end of jet pitch (Y turn)

            //start jet Z turn
            if (Intellect.IsControlKeyPressed(GameControlKeys.Right) || Intellect.IsControlKeyPressed(GameControlKeys.Left))
            {
                float right = Intellect.GetControlKeyStrength(GameControlKeys.Right) / 2;
                float left  = Intellect.GetControlKeyStrength(GameControlKeys.Left) / 2;
                TrunZ += (left - right);
                MathFunctions.Clamp(ref TrunZ, -10, 10);
            }
            else
            {
                if (TrunZ != 0)
                {
                    TrunZ -= TrunZ / 5;

                    if ((TrunZ - (TrunZ % 1)) == 0)
                    {
                        TrunZ = 0;
                    }
                }
            }

            if (TrunZ != 0)
            {
                AKJetBody.AddForce(ForceType.GlobalTorque, TickDelta,
                                   AKJetBody.Rotation * new Vec3(0, 0, (TrunZ * 2) * ControlersRatio) * MASS, Vec3.Zero);
            }
            //end of jet Z turn

            //start jet X turn
            if (Intellect.IsControlKeyPressed(GameControlKeys.Arrow_Right) || Intellect.IsControlKeyPressed(GameControlKeys.Arrow_Left))
            {
                float rightX = Intellect.GetControlKeyStrength(GameControlKeys.Arrow_Right) / 2;
                float leftX  = Intellect.GetControlKeyStrength(GameControlKeys.Arrow_Left) / 2;
                TrunX += (rightX - leftX);
                MathFunctions.Clamp(ref TrunX, -10, 10);
            }
            else
            {
                if (TrunX != 0)
                {
                    TrunX -= TrunX / 5;

                    if ((TrunX - (TrunX % 1)) == 0)
                    {
                        TrunX = 0;
                    }
                }
            }

            if (TrunX != 0)
            {
                AKJetBody.AddForce(ForceType.GlobalTorque, TickDelta,
                                   AKJetBody.Rotation * new Vec3(((TrunX * 2) * ControlersRatio), 0, 0) * MASS, Vec3.Zero);
            }

            //Pitch on Turn Pitch

            //float TurnPitch = AKJetBody.Rotation.GetInverse().ToAngles().Roll; //1 - Rotation.GetUp().Z;
            //if (TurnPitch < 0) TurnPitch = -TurnPitch;
            //if (TurnPitch > 90) TurnPitch = 90 - (TurnPitch - 90);

            //AKJetBody.AddForce(ForceType.GlobalTorque, TickDelta,
            //       AKJetBody.Rotation * new Vec3(0, ((-TurnPitch /90) * ControlersRatio), 0) * MASS, Vec3.Zero);

            //End of Pitch on Turn
            //end of jet X turn

            //start of adding main Engine force

            MathFunctions.Clamp(ref force, 0.1f, 100);

            //if Max Alt is not reached add jet motor force
            if (AKJetBody.Position.Z < Type.MaxAlt)
            {
                float FinalEngineForce = (force / 2f) - ((PitchUp / 90) * 30);

                AKJetBody.AddForce(ForceType.LocalAtLocalPos, TickDelta,
                                   new Vec3(FinalEngineForce, 0, 0) * MASS, Vec3.Zero);
            }

            //dampings
            AKJetBody.AngularDamping = 2f + (speed / 60);
            AKJetBody.LinearDamping  = 0.4f;
        }
Beispiel #15
0
        private void TickIntellect()
        {
            GUIshit();
            MapObjectAttachedParticle JetFire1 = GetFirstAttachedObjectByAlias("JetFire1") as MapObjectAttachedParticle;
            MapObjectAttachedParticle JetFire2 = GetFirstAttachedObjectByAlias("JetFire2") as MapObjectAttachedParticle;
            float speed = GetRealSpeed();

            AKunit akunit = GetPlayerUnit() as AKunit;

            Vec3   dir        = AKVTOLBody.Rotation.GetForward();
            Radian slopeAngle = MathFunctions.ATan(dir.Z, dir.ToVec2().Length());

            MASS = 0;
            foreach (Body body in PhysicsModel.Bodies)
            {
                MASS += body.Mass;
            }

            ShiftBooster();

            AKVTOLOn = Intellect != null && Intellect.IsActive();
            // GUItest();
            ALTray();

            //engine force + sound pitch control
            if (Intellect.IsControlKeyPressed(GameControlKeys.Jump))
            {
                if (akunit != null)
                {
                    akunit.GunsTryFire(false);
                }
            }

            if (Intellect.IsControlKeyPressed(GameControlKeys.Forward))
            {
                force += forceadd;
            }
            else if (Intellect.IsControlKeyPressed(GameControlKeys.Backward))
            {
                force -= forceadd;
            }
            else
            {
            }

            if (Intellect.IsControlKeyPressed(GameControlKeys.VerticleTakeOff_L_EngineUp))
            {
                EngineDir += 2f;
            }
            else if (Intellect.IsControlKeyPressed(GameControlKeys.VerticleTakeOff_L_EngineDown))
            {
                EngineDir -= 2f;
            }
            else
            {
            }

            MathFunctions.Clamp(ref EngineDir, 0, 90);

            EngineApp.Instance.ScreenGuiRenderer.AddText("Throttle: " + force, new Vec2(.6f, .1f));

            if (JetFire1 != null && JetFire2 != null)
            {
                if (force > 85f)
                {
                    JetFire1.Visible = true;
                    JetFire2.Visible = true;
                }
                else
                {
                    JetFire1.Visible = false;
                    JetFire2.Visible = false;
                }
            }

            enpitch = 0.8f + (0.6f * (force / 100));
            MathFunctions.Clamp(ref force, 0.1f, 100);
            MathFunctions.Clamp(ref enpitch, 0.8f, 1.4f);

            //update jet channel position and pitch
            if (rotorSoundChannel != null)
            {
                //update channel
                rotorSoundChannel.Pitch    = enpitch;
                rotorSoundChannel.Volume   = 1;
                rotorSoundChannel.Position = Position;
                //rotorSoundChannel.MinDistance = 10;
            }

            //end of engine force + sound pitch control

            //Forces
            ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

            //start VTOL Pitch (Y turn)
            if (Intellect.IsControlKeyPressed(GameControlKeys.Arrow_Up) || Intellect.IsControlKeyPressed(GameControlKeys.Arrow_Down))
            {
                float AUp   = Intellect.GetControlKeyStrength(GameControlKeys.Arrow_Up) / 2;
                float ADown = Intellect.GetControlKeyStrength(GameControlKeys.Arrow_Down) / 2;
                Hpitch += (AUp - ADown);
                MathFunctions.Clamp(ref Hpitch, -10, 10);
            }
            else
            {
                if (Hpitch != 0)
                {
                    Hpitch -= Hpitch / 5;

                    if ((Hpitch - (Hpitch % 1)) == 0)
                    {
                        Hpitch = 0;
                    }
                }
                else
                {
                    float mammadpitch = (AKVTOLBody.AngularVelocity * AKVTOLBody.Rotation.GetInverse()).Y * 2;

                    MathFunctions.Clamp(ref mammadpitch, -10f, 10);
                    AKVTOLBody.AddForce(ForceType.GlobalAtLocalPos, TickDelta,
                                        AKVTOLBody.Rotation * new Vec3(0, 0, -mammadpitch) * MASS, new Vec3(-8, 0, 0));

                    EngineApp.Instance.ScreenGuiRenderer.AddText("MammadPitch: " + mammadpitch.ToString(), new Vec2(.1f, .2f));
                }
            }

            if (Hpitch != 0)
            {
                AKVTOLBody.AddForce(ForceType.GlobalTorque, TickDelta,
                                    AKVTOLBody.Rotation * new Vec3(0, Hpitch, 0) * MASS, Vec3.Zero);
            }
            //end of VTOL pitch (Y turn)

            //start jet Z turn
            if (Intellect.IsControlKeyPressed(GameControlKeys.Right) || Intellect.IsControlKeyPressed(GameControlKeys.Left))
            {
                float right = Intellect.GetControlKeyStrength(GameControlKeys.Right) / 2;
                float left  = Intellect.GetControlKeyStrength(GameControlKeys.Left) / 2;
                TrunZ += (left - right);
                MathFunctions.Clamp(ref TrunZ, -10, 10);

                AKVTOLBody.AddForce(ForceType.LocalTorque, TickDelta,
                                    new Vec3(0, 0, TrunZ * 2) * MASS, Vec3.Zero);
            }
            else
            {
                TrunZ = 0;
            }
            //end of jet Z turn

            //start jet X turn
            if (Intellect.IsControlKeyPressed(GameControlKeys.Arrow_Right) || Intellect.IsControlKeyPressed(GameControlKeys.Arrow_Left))
            {
                float rightX = Intellect.GetControlKeyStrength(GameControlKeys.Arrow_Right) / 2;
                float leftX  = Intellect.GetControlKeyStrength(GameControlKeys.Arrow_Left) / 2;
                TrunX += (rightX - leftX);
                MathFunctions.Clamp(ref TrunX, -10, 10);

                AKVTOLBody.AddForce(ForceType.GlobalTorque, TickDelta,
                                    AKVTOLBody.Rotation * new Vec3(TrunX * 2, 0, 0) * MASS, Vec3.Zero);
            }
            else
            {
                TrunX = 0;
            }

            float SHOOT = AKVTOLBody.Rotation.GetInverse().ToAngles().Roll; //1 - Rotation.GetUp().Z;

            if (SHOOT < 0)
            {
                SHOOT = -SHOOT;
            }
            if (SHOOT > 90)
            {
                SHOOT = 90 - (SHOOT - 90);
            }

            AKVTOLBody.AddForce(ForceType.GlobalAtLocalPos, TickDelta,
                                AKVTOLBody.Rotation * new Vec3(0, 0, -SHOOT / 180) * MASS, new Vec3(-8, 0, 0));

            //end of jet X turn

            //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            //adding anty  Y movment force
            float Yshit = (AKVTOLBody.LinearVelocity * Rotation.GetInverse()).Y;

            EngineApp.Instance.ScreenGuiRenderer.AddText("Yshit: " + Yshit.ToString(), new Vec2(.6f, .3f));
            EngineApp.Instance.ScreenGuiRenderer.AddText("roll: " + Rotation.ToAngles().Roll, new Vec2(.6f, .35f));
            EngineApp.Instance.ScreenGuiRenderer.AddText("roll: " + (Rotation.GetInverse().ToAngles()).ToString(), new Vec2(.6f, .4f));
            EngineApp.Instance.ScreenGuiRenderer.AddText("Edir: " + EngineDir.ToString(), new Vec2(.1f, .6f));

            //start of adding force

            MathFunctions.Clamp(ref force, 0.1f, 100);

            EngineApp.Instance.ScreenGuiRenderer.AddText("speed: " + GetRealSpeed().ToString(), new Vec2(.6f, .15f));
            GUItest();
            //anti gravity when jet have speed (wings force)

            float antyshityforcy = GetRealSpeed() / 10;

            float slopeangleshit = 1.5f;

            MathFunctions.Clamp(ref antyshityforcy, 0, 10);
            if (slopeAngle > 0)
            {
                slopeangleshit = 1.5f - slopeAngle;
            }
            else
            {
                slopeangleshit = 0.5f;
            }

            if (GetRealSpeed() > 0)
            {
                AKVTOLBody.AddForce(ForceType.LocalAtLocalPos, TickDelta,
                                    new Vec3(0, 0, antyshityforcy * slopeangleshit) * MASS, Vec3.Zero);
            }

            //if Max Alt is not reached add jet motor force
            if (AKVTOLBody.Position.Z < Type.MaxAlt)
            {
                AKVTOLBody.AddForce(ForceType.GlobalAtLocalPos, TickDelta,
                                    AKVTOLBody.Rotation * new Vec3(force / 2f * ((90 - EngineDir) / 90), 0, force / 8f * (EngineDir / 90)) * MASS, Vec3.Zero);
            }

            //dampings
            AKVTOLBody.AngularDamping = 2f + (speed / 60);
            AKVTOLBody.LinearDamping  = 0.6f;

            ServoMotor Lenginem = PhysicsModel.GetMotor("LEngineM") as ServoMotor;
            ServoMotor Renginem = PhysicsModel.GetMotor("REngineM") as ServoMotor;

            if (Lenginem != null && Renginem != null)
            {
                float EngingDirRad = EngineDir * MathFunctions.PI / 180;
                Renginem.DesiredAngle = EngingDirRad;
                Lenginem.DesiredAngle = EngingDirRad;
            }
        }
        protected override void OnPostCreate(bool loaded)
        {
            base.OnPostCreate(loaded);
            AddTimer();
            bool existsAttachedObjects = false;

            //show attached objects for this influence
            foreach (MapObjectAttachedObject attachedObject in this.AttachedObjects)
            {
                if (attachedObject.Alias == Type.Name)
                {
                    attachedObject.Visible = true;
                    existsAttachedObjects = true;
                }
            }

            if (!existsAttachedObjects)
            {
                //create default particle system
                if (!string.IsNullOrEmpty(Type.DefaultParticleName))
                {
                    defaultAttachedParticle = new MapObjectAttachedParticle();
                    defaultAttachedParticle.ParticleName = Type.DefaultParticleName;
                    this.Attach(defaultAttachedParticle);
                    defaultAttachedParticle.PositionOffset = this.Type.ParticlePosition;
                }
            }
        }