예제 #1
0
        public Missile(PhysicsManager physicsenabler, float damage)
            : base(GameState.Get().Game.Content.Load<Model>("missile"))
        {
            this.Damage = damage;
            this.pm = physicsenabler;
            SetWorld(1f,
                    new Vector3(110, 10, 110),
                    Quaternion.CreateFromAxisAngle(Vector3.UnitY, (float)Math.PI / 5));//* Quaternion.CreateFromAxisAngle(Vector3.UnitZ, (float)Math.PI / 4));
            LinearVelocity = Vector3.Zero;
            AngularVelocity = Vector3.Zero;

            this.m_dragModule = new LinearDragModule(this, LINEAR_DRAG_COEFFICIENT);
            this.m_thrustModule = new ThrustModule(this, THRUST_MULTIPLIER, 1f, MAX_FUEL);
            this.m_angDragModule = new AngularDragModule(this, ANGULAR_DRAG_COEFFICIENT);

            Capsule capsule = new Capsule(new Vector3(5, 0, 0), Vector3.Zero, 1);
            Vector3 center = new Vector3(2.5f, 0, 0);
            MassProperties mp = MassProperties.FromCapsule(0.15f, capsule.P1, capsule.P2, capsule.Radius, out center);
            this.MassProperties = mp;
            this.Skin.Add(new CapsulePart(capsule));
        }
예제 #2
0
        private void initialize()
        {
            this.m_thrustModule = new ThrustModule(this, THRUST_MULTIPLIER * this.thrust, 1f, MAX_FUEL);//1f is fuel gain
            this.m_linDragModule = new LinearDragModule(this, LINEAR_DRAG_COEFFICIENT);
            this.m_liftModule = new LiftModule(this, LIFT_COEFFICIENT);
            this.m_angDragModule = new AngularDragModule(this, ANGULAR_DRAG_COEFFICIENT);
            this.m_dmgModule = new DamageModule(this, 0, 0, 0);
            this.m_pitchDirModule = new PitchDirectionalModule(this, LINVEL_FORWARD_CONVERSION_RATE);
            this.LastPosition = Vector3.Zero;
            this.Flaps = true;
            this.LGears = true;
            SetWorld(
                    STARTING_POSITION,
                    STARTING_ORIENTATION);//* Quaternion.CreateFromAxisAngle(Vector3.UnitZ, (float)Math.PI / 4));
            LinearVelocity = Vector3.Zero;
            AngularVelocity = Vector3.Zero;

            Capsule massCapsule = new Capsule(new Vector3(5, 0, 0), Vector3.Zero, 1);
            Vector3 center = new Vector3(2.5f, 0, 0);
            MassProperties mp = MassProperties.FromCapsule(0.15f, massCapsule.P1, massCapsule.P2, massCapsule.Radius, out center);
            this.MassProperties = mp;
            Capsule skinCapsule = new Capsule(new Vector3(25, 0, 0), new Vector3(-25, 0, 0), 15);
            this.Skin.Add(new CapsulePart(skinCapsule));

            //this.initialize
        }