示例#1
0
        /// <summary>
        /// Single Primitive Constructor with predefined MaterialProperty
        /// </summary>
        /// <param name="position">Initial Body Position</param>
        /// <param name="scale">Scale</param>
        /// <param name="primative">Primitive to add to Skin</param>
        /// <param name="propId">Predefined Material Properties of Primitive</param>
        public Gobject(Vector3 position, Vector3 scale, Primitive primative, MaterialTable.MaterialID propId, Model model, string asset)
            : this()
        {
            Skin.AddPrimitive(primative, (int)propId);

            CommonInit(position, scale, model, true, asset);
        }
示例#2
0
        /// <summary>
        /// Single Primitive Constructor with custom MaterialProperty
        /// </summary>
        /// <param name="position">Initial Body Position</param>
        /// <param name="scale">Scale</param>
        /// <param name="primative">Primitive to add to Skin</param>
        /// <param name="prop">Material Properties of Primitive</param>
        public Gobject(Vector3 position, Vector3 scale, Primitive primative, MaterialProperties prop, Model model, string asset)
            : this()
        {
            Skin.AddPrimitive(primative, prop);

            CommonInit(position, scale, model, true, asset);
        }
示例#3
0
文件: Chassis.cs 项目: jdarc/jiglibx
        public void SetDims(Vector3 min, Vector3 max)
        {
            _dimsMin = min;
            _dimsMax = max;
            var sides       = max - min;
            var topBotRatio = 0.4f;

            var max1 = max;

            max1.Y -= topBotRatio * sides.Y;
            var box1 = new Box(min, Matrix.Identity, max1 - min);

            var min2 = min;

            min2.Y += topBotRatio * sides.Y;
            var max2 = max;

            min2.X += sides.X * 0.05f;
            max2.X -= sides.X * 0.3f;
            min2.Z *= 0.9f;
            max2.Z *= 0.9f;

            var box2 = new Box(min2, Matrix.Identity, max2 - min2);

            Skin.RemoveAllPrimitives();
            Skin.AddPrimitive(box1, new MaterialProperties(0.3f, 0.5f, 0.3f));
            Skin.AddPrimitive(box2, new MaterialProperties(0.3f, 0.5f, 0.3f));

            _body.Car.SetupDefaultWheels();
        }
示例#4
0
        public LunarVehicle(Vector3 position, Vector3 scale, Matrix orient, Model model, int asset)
            : base()
        {
            Vector3 sides = new Vector3(1f * scale.X, 1.75f * scale.Y, 1f * scale.Z);

            Skin.AddPrimitive(new Box(new Vector3(sides.X * -.5f, sides.Y * -.5f, sides.Z * -.5f), orient, sides), (int)MaterialTable.MaterialID.NotBouncyNormal);   // Top portion
            sides = new Vector3(scale.X * 2.1f, scale.Y * 1.15f, scale.Z * 2.1f);
            Skin.AddPrimitive(new Box(new Vector3(sides.X * -.5f, sides.Y * -1.45f, sides.Z * -.5f), orient, sides), (int)MaterialTable.MaterialID.NotBouncyNormal); // Legs
            CommonInit(position, scale / 2, model, true, asset);

            VertJet = new BoostController(Body, Vector3.Up, Vector3.Zero);
            RotJetX = new BoostController(Body, Vector3.Zero, Vector3.UnitZ);
            RotJetZ = new BoostController(Body, Vector3.Zero, Vector3.UnitX);
            RotJetY = new BoostController(Body, Vector3.Zero, Vector3.UnitY);

            PhysicsSystem.CurrentPhysicsSystem.AddController(VertJet);
            PhysicsSystem.CurrentPhysicsSystem.AddController(RotJetX);
            PhysicsSystem.CurrentPhysicsSystem.AddController(RotJetZ);
            PhysicsSystem.CurrentPhysicsSystem.AddController(RotJetY);

            actionManager.AddBinding((int)Actions.ThrustUp, new Helper.Input.ActionBindingDelegate(GenericThrustUp), 1);
            actionManager.AddBinding((int)Actions.Pitch, new Helper.Input.ActionBindingDelegate(GenericPitch), 1);
            actionManager.AddBinding((int)Actions.Roll, new Helper.Input.ActionBindingDelegate(GenericRoll), 1);
            actionManager.AddBinding((int)Actions.Yaw, new Helper.Input.ActionBindingDelegate(GenericYaw), 1);
        }
示例#5
0
        /// <summary>
        /// Multiple Primitive Constructor
        /// Each Primitive needs a Material Property
        /// </summary>
        /// <param name="position">Initial Body Position</param>
        /// <param name="scale">Scale</param>
        /// <param name="primatives">Primitives to add to Skin</param>
        /// <param name="props">Material Properties of Primitives to add</param>
        public Gobject(Vector3 position, Vector3 scale, List <Primitive> primatives, List <MaterialProperties> props, Model model, string asset)
            : this()
        {
            for (int i = 0; i < primatives.Count && i < props.Count; i++)
            {
                Skin.AddPrimitive(primatives[i], props[i]);
            }

            CommonInit(position, scale, model, true, asset);
        }
示例#6
0
 public Gobject(Vector3 position, Vector3 scale, Primitive primitive, Model model, bool moveable, string asset)
     : this()
 {
     try
     {
         Skin.AddPrimitive(primitive, (int)MaterialTable.MaterialID.NotBouncyNormal);
         //CollisionSkin collision = new CollisionSkin(null);
         //Skin.AddPrimitive(primitive, 2);
         CommonInit(position, scale, model, moveable, asset);
         //Body.CollisionSkin = collision;
     }
     catch (Exception E)
     {
     }
 }
示例#7
0
 public Gobject(Vector3 position, Vector3 scale, Primitive primitive, Model model, bool moveable, int asset)
     : this()
 {
     try
     {
         Skin.AddPrimitive(primitive, (int)MaterialTable.MaterialID.NotBouncyNormal);
         //CollisionSkin collision = new CollisionSkin(null);
         //Skin.AddPrimitive(primitive, 2);
         CommonInit(position, scale, model, moveable, asset);
         //Body.CollisionSkin = collision;
     }
     catch (Exception E)
     {
         System.Diagnostics.Debug.WriteLine(E.StackTrace);
     }
 }