示例#1
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)
            : this()
        {
            Skin.AddPrimitive(primative, prop);

            CommonInit(position, scale, model, true);
        }
        public void AddCollisionShape(ICollisionShape collisionShape)
        {
            var primitive = collisionShape as Primitive;
            if (primitive == null) throw new ArgumentException("Invalid collision shape type.", "collisionShape");

            var material = new MaterialProperties(
                collisionShape.Restitution, collisionShape.StaticFriction, collisionShape.DynamicFriction);

            AddPrimitive(primitive, material);
        }
        public TriangleMeshObject(string id, ObjectType objectType, Transform3D transform, Effect effect, 
            Texture2D texture, Model model, Color color, float alpha, MaterialProperties materialProperties)
            : base(id, objectType, transform, effect, texture, model, color, alpha)
        {
            //get the primitive mesh which forms the skin
            TriangleMesh triangleMesh = GetTriangleMesh(model, transform);

            //add the primitive mesh to the collision skin
            this.Body.CollisionSkin.AddPrimitive(triangleMesh, materialProperties);
        }
示例#4
0
        public void SetMaterialProperties(int id, MaterialProperties properties)
        {
            materials[id] = properties;

            foreach (var it in materials)
            {
                var otherID = it.Key;
                var mat     = it.Value;

                var key01 = (otherID << 16) | id;
                var key10 = (id << 16) | otherID;
                materialPairs[key01] = materialPairs[key10] = new MaterialPairProperties(properties.Elasticity * mat.Elasticity, properties.StaticRoughness * mat.StaticRoughness, properties.DynamicRoughness * mat.DynamicRoughness);
            }
        }
示例#5
0
        /// <summary>
        /// This adds/overrides a material, and sets all the pairs for
        /// existing materials using some sensible heuristic
        /// </summary>
        /// <param name="id"></param>
        /// <param name="properties"></param>
        public void SetMaterialProperties(int id, MaterialProperties properties)
        {
            materials[id] = properties;

            foreach (KeyValuePair <int, MaterialProperties> it in materials)
            {
                int otherID            = it.Key;
                MaterialProperties mat = it.Value;

                int key01 = otherID << 16 | id;
                int key10 = id << 16 | otherID;
                materialPairs[key01] = materialPairs[key10] =
                    new MaterialPairProperties(properties.Elasticity * mat.Elasticity,
                                               properties.StaticRoughness * mat.StaticRoughness,
                                               properties.DynamicRoughness * mat.DynamicRoughness);
            }
        }
        /// <summary>
        /// Adds a primitive to this collision skin - the primitive is
        /// copied (so you can pass in something on the stack, or delete
        /// the original) - perhaps using reference counting.  Returns the
        /// primitive index, or -1 if failure Also takes that material ID
        /// and the properties used when a collision ID is USER_DEFINED
        /// </summary>
        /// <param name="prim"></param>
        /// <param name="matID"></param>
        /// <param name="matProps"></param>
        /// <returns>int</returns>
        private int AddPrimitive(Primitive prim, int matID, MaterialProperties matProps)
        {
            Primitive newPrim = prim.Clone();

            if (newPrim == null)
            {
                throw new ArgumentException("Not able to clone primitive!");
            }

            materialIDs.Add(matID);
            materialProperties.Add(matProps);

            primitivesOldWorld.Add(prim.Clone());
            primitivesNewWorld.Add(prim.Clone());
            primitivesLocal.Add(newPrim);

            UpdateWorldBoundingBox();

            return(materialIDs.Count - 1);
        }
示例#7
0
        /// <summary>
        /// Adds a primitive to this collision skin - the primitive is
        /// copied (so you can pass in something on the stack, or delete
        /// the original) - perhaps using reference counting.  Returns the
        /// primitive index, or -1 if failure Also takes that material ID
        /// and the properties used when a collision ID is USER_DEFINED
        /// </summary>
        /// <param name="prim"></param>
        /// <param name="matID"></param>
        /// <param name="matProps"></param>
        /// <returns></returns>
        public int AddPrimitive(Primitive prim, int matID, MaterialProperties matProps)
        {
            Primitive newPrim = prim.Clone();

            if (newPrim == null)
            {
                System.Diagnostics.Debug.WriteLine("CollisionSkin.AddPrimitive Unable to clone primitive");
                return(-1);
            }

            primitivesOldWorld.Add(prim.Clone());
            primitivesNewWorld.Add(prim.Clone());
            primitivesLocal.Add(newPrim);

            materialIDs.Add(matID);
            materialProperties.Add(matProps);

            UpdateWorldBoundingBox();

            return(materialIDs.Count - 1);
        }
示例#8
0
        private unsafe void Init(CollDetectInfo info, Vector3 dirToBody0, SmallCollPointInfo *pointInfos, int numPointInfos)
        {
            this.SkinInfo   = info;
            this.dirToBody0 = dirToBody0;

            int ID0 = info.Skin0.GetMaterialID(info.IndexPrim0);
            int ID1 = info.Skin1.GetMaterialID(info.IndexPrim1);

            MaterialTable matTable = info.Skin0.CollisionSystem.MaterialTable;

            if (ID0 == (int)MaterialTable.MaterialID.UserDefined || (int)ID1 == (int)MaterialTable.MaterialID.UserDefined)
            {
                MaterialProperties prop0 = info.Skin0.GetMaterialProperties(info.IndexPrim0);
                MaterialProperties prop1 = info.Skin1.GetMaterialProperties(info.IndexPrim1);

                MatPairProperties.Restitution     = prop0.Elasticity * prop1.Elasticity;
                MatPairProperties.StaticFriction  = prop0.StaticRoughness * prop1.StaticRoughness;
                MatPairProperties.DynamicFriction = prop0.DynamicRoughness * prop1.DynamicRoughness;
            }
            else
            {
                MatPairProperties = matTable.GetPairProperties(ID0, ID1);
            }

            numPointInfos = (numPointInfos > MaxCollisionPoints) ? MaxCollisionPoints : numPointInfos;

            NumCollPts = 0;
            for (int i = 0; i < numPointInfos; ++i)
            {
                if (freePtInfos.Count == 0)
                {
                    freePtInfos.Push(new CollPointInfo());
                }
                this.PointInfo[NumCollPts] = freePtInfos.Pop();
                this.PointInfo[NumCollPts++].Init(ref pointInfos[i]);
            }
        }
示例#9
0
        /// <summary>
        /// This adds/overrides a material, and sets all the pairs for
        /// existing materials using some sensible heuristic
        /// </summary>
        /// <param name="id"></param>
        /// <param name="properties"></param>
        public void SetMaterialProperties(int id, MaterialProperties properties)
        {
            materials[id] = properties;

            foreach (KeyValuePair<int, MaterialProperties> it in materials)
            {
                int otherID = it.Key;
                MaterialProperties mat = it.Value;

                int key01 = otherID << 16 | id;
                int key10 = id << 16 | otherID;
                materialPairs[key01] = materialPairs[key10] =
                    new MaterialPairProperties(properties.Elasticity * mat.Elasticity,
                        properties.StaticRoughness * mat.StaticRoughness,
                        properties.DynamicRoughness * mat.DynamicRoughness);
            }
        }
示例#10
0
        /// <summary>
        /// Adds a primitive to this collision skin - the primitive is
        /// copied (so you can pass in something on the stack, or delete
        /// the original) - perhaps using reference counting.  Returns the
        /// primitive index, or -1 if failure Also takes that material ID
        /// and the properties used when a collision ID is USER_DEFINED
        /// </summary>
        /// <param name="prim"></param>
        /// <param name="matID"></param>
        /// <param name="matProps"></param>
        /// <returns>int</returns>
        private int AddPrimitive(Primitive prim, int matID, MaterialProperties matProps)
        {
            Primitive newPrim = prim.Clone();

            if (newPrim == null)
                throw new ArgumentException("Not able to clone primitive!");

            materialIDs.Add(matID);
            materialProperties.Add(matProps);

            primitivesOldWorld.Add(prim.Clone());
            primitivesNewWorld.Add(prim.Clone());
            primitivesLocal.Add(newPrim);

            UpdateWorldBoundingBox();

            return materialIDs.Count - 1;
        }
示例#11
0
 /// <summary>
 /// Sets the material properties for a primitive. In this case the
 /// material ID will be automatically set to USER_DEFINED
 /// </summary>
 /// <param name="prim"></param>
 /// <param name="matProperties"></param>
 public void SetMaterialProperties(int prim, MaterialProperties matProperties)
 {
     materialProperties[prim] = matProperties;
     materialIDs[prim] = (int)MaterialTable.MaterialID.UserDefined;
 }
示例#12
0
 /// <summary>
 /// Adds a Primitive
 /// </summary>
 /// <param name="prim"></param>
 /// <param name="matProps"></param>
 /// <returns>int</returns>
 public int AddPrimitive(Primitive prim, MaterialProperties matProps)
 {
     return AddPrimitive(prim, (int)MaterialTable.MaterialID.UserDefined, matProps);
 }
示例#13
0
        public void CreatePlane(Vector3 normal, float d)
        {
            this.collisionSkin = new CollisionSkin(null);

            JigLibX.Geometry.Plane primitivePlane =
                new JigLibX.Geometry.Plane(normal, d);

            MaterialProperties materialProp = new MaterialProperties(
                elasticity, staticRoughness, dynamicRoughness);

            CollisionSkin.AddPrimitive(primitivePlane, materialProp);

            PhysicsSystem.CurrentPhysicsSystem.CollisionSystem.AddCollisionSkin(this.CollisionSkin);
            Body.CollisionSkin = CollisionSkin;
            CollisionSkin.Owner = Body;
        }
示例#14
0
        /// <summary>
        /// Adds a primitive to this collision skin - the primitive is
        /// copied (so you can pass in something on the stack, or delete
        /// the original) - perhaps using reference counting.  Returns the
        /// primitive index, or -1 if failure Also takes that material ID
        /// and the properties used when a collision ID is USER_DEFINED
        /// </summary>
        /// <param name="prim"></param>
        /// <param name="matID"></param>
        /// <param name="matProps"></param>
        /// <returns></returns>
        public int AddPrimitive(Primitive prim, int matID, MaterialProperties matProps)
        {
            Primitive newPrim = prim.Clone();

            if (newPrim == null)
            {
                System.Diagnostics.Debug.WriteLine("CollisionSkin.AddPrimitive Unable to clone primitive");
                return -1;
            }

            primitivesOldWorld.Add(prim.Clone());
            primitivesNewWorld.Add(prim.Clone());
            primitivesLocal.Add(newPrim);

            materialIDs.Add(matID);
            materialProperties.Add(matProps);

            UpdateWorldBoundingBox();

            return materialIDs.Count - 1;
        }
示例#15
0
        public void SetPrimitive(Primitive primitive, Vector3 position, Matrix orientation)
        {
            this.collisionSkin = new CollisionSkin(this.Body);

            MaterialProperties materialProp = new MaterialProperties(
                elasticity, staticRoughness, dynamicRoughness);

            CollisionSkin.AddPrimitive(primitive, materialProp);

            SetupProperty(position, orientation);
        }
示例#16
0
        public void CreateBoxes(Vector3 position, Matrix orientation, Box[] primitiveBoxes)
        {
            this.collisionSkin = new CollisionSkin(this.Body);

            MaterialProperties materialProp = new MaterialProperties(
                elasticity, staticRoughness, dynamicRoughness);

            foreach (Box box in primitiveBoxes)
            {
                CollisionSkin.AddPrimitive(box, materialProp);
            }

            SetupProperty(position, orientation);
        }
示例#17
0
 /// <summary>
 /// Adds a Primitive
 /// </summary>
 /// <param name="prim"></param>
 /// <param name="matProps"></param>
 /// <returns>int</returns>
 public int AddPrimitive(Primitive prim, MaterialProperties matProps)
 {
     return(AddPrimitive(prim, (int)MaterialTable.MaterialID.UserDefined, matProps));
 }
        private void InitializeModels()
        {
            Texture2D texture = null;
            //MoveableModelObject playerActor = null;
            Transform3D transform = null;
            Model model = null;
            ModelObject modelObject = null;
            CollidableObject collidableObj = null;
            PawnCollidableObject collObj = null;
            ZoneObject zoneObj = null;
            CameraZoneObject camObj = null;

            #region Player Model
            model = this.modelDictionary["player"];
            transform = new Transform3D(new Vector3(-100, 10, 0),
                new Vector3(-90, 0, 0), 0.15f * Vector3.One,
                Vector3.UnitX, Vector3.UnitY);
            this.playerActor = new PlayerObject("player",
                ObjectType.Player, transform, this.animatedModelEffect, null, model, Color.White, 1f, KeyData.Player_Keys, 3.75f, 11.5f, 1f, 1f, new Vector3(0, 0, 0));
            this.playerActor.Enable(false, 100);
            this.objectManager.Add(this.playerActor);
            #endregion

            #region ExitDoor Model
            model = this.modelDictionary["door"];
            transform = new Transform3D(new Vector3(140, 0, 0), Vector3.Zero, 1f * Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            this.doorActor = new PawnCollidableObject("door", ObjectType.Door, transform, this.texturedModelEffect, null, model, Color.White, 1f);
            Vector3 scales = new Vector3(12, 250, 25);
            this.doorActor.AddPrimitive(new Box(transform.Translation, Matrix.Identity, scales), new MaterialProperties());
            this.doorActor.Enable(true, 2000);

            this.objectManager.Add(this.doorActor);
            #endregion
            #region EntranceDoor Model
            model = this.modelDictionary["door"];
            transform = new Transform3D(new Vector3(-300, 0, 0), Vector3.Zero, 1f * Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            collObj = new PawnCollidableObject("door", ObjectType.Entrance, transform, this.texturedModelEffect, null, model, Color.White, 1f);
            collObj.AddPrimitive(new Box(transform.Translation, Matrix.Identity, scales), new MaterialProperties());
            collObj.Enable(true, 2000);

            this.objectManager.Add(collObj);
            #endregion
            texture = Content.Load<Texture2D>("Assets\\Textures\\Game\\white");
            #region Room Model
            model = this.modelDictionary["room"];
            transform = new Transform3D(new Vector3(0, 0, 0), new Vector3(0,180,0), 1f * Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            MaterialProperties material = new MaterialProperties(1f, 0.1f, 0.05f);
            collidableObj = new CollidableObject("room", ObjectType.Room, transform, this.texturedModelEffect, null, model, Color.White, 1);
            //floor
            scales = new Vector3(300, 1, 300);
            collidableObj.AddPrimitive(new Box(transform.Translation, Matrix.Identity, scales), material);
            collidableObj.Enable(true, 2000);

            this.objectManager.Add(collidableObj);

            scales = new Vector3(10, 100, 300);
            transform = new Transform3D(new Vector3(152, 0, 0), Vector3.Zero, scales, -Vector3.UnitZ, Vector3.UnitY);
            zoneObj = new ZoneObject("roomwallback", ObjectType.Room, transform, this.primitiveEffect, Color.Red, 1, true);
            zoneObj.AddPrimitive(new Box(transform.Translation, Matrix.Identity, transform.Scale));
            zoneObj.Enable();

            this.objectManager.Add(zoneObj);

            transform = new Transform3D(new Vector3(-152, 0, 0), Vector3.Zero, scales, -Vector3.UnitZ, Vector3.UnitY);
            zoneObj = new ZoneObject("roomwallfront", ObjectType.Room, transform, this.primitiveEffect, Color.Red, 1, true);
            zoneObj.AddPrimitive(new Box(transform.Translation, Matrix.Identity, transform.Scale));
            zoneObj.Enable();

            this.objectManager.Add(zoneObj);

            scales = new Vector3(300, 100, 5);
            transform = new Transform3D(new Vector3(0, 0, 130), Vector3.Zero, scales, -Vector3.UnitZ, Vector3.UnitY);
            zoneObj = new ZoneObject("roomwallright", ObjectType.Room, transform, this.primitiveEffect, Color.Red, 1, true);
            zoneObj.AddPrimitive(new Box(transform.Translation, Matrix.Identity, transform.Scale));
            zoneObj.Enable();

            this.objectManager.Add(zoneObj);

            transform = new Transform3D(new Vector3(0, 0, -130), Vector3.Zero, scales, -Vector3.UnitZ, Vector3.UnitY);
            zoneObj = new ZoneObject("roomwallleft", ObjectType.Room, transform, this.primitiveEffect, Color.Red, 1, true);
            zoneObj.AddPrimitive(new Box(transform.Translation, Matrix.Identity, transform.Scale));
            zoneObj.Enable();

            this.objectManager.Add(zoneObj);
            #endregion

            #region Rotationthingy Model
            model = this.modelDictionary["rotation"];
            transform = new Transform3D(new Vector3(0, -57, 0), Vector3.Zero, 0.6f * Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            this.rotator = new PawnCollidableObject("RotationThingy", ObjectType.Rotation, transform, this.texturedModelEffect, null, model, Color.White, 1);
            Matrix rot;
            this.rotator.AddPrimitive(new Capsule(transform.Translation - new Vector3(0, 0, 20 * 0.6f), Matrix.Identity, 2.5f * 0.6f, 40 * 0.6f), new MaterialProperties());
            Matrix.CreateRotationY(MathHelper.ToRadians(90), out rot);
            this.rotator.AddPrimitive(new Capsule(transform.Translation - new Vector3(20 *0.6f, 0, 0), rot, 2.5f * 0.6f, 40 * 0.6f), new MaterialProperties());
            this.rotator.Enable(true, 200);

            this.objectManager.Add(this.rotator);
            #endregion

            //Walls are initialized after Rotator because of their dependancy on Rotator (see RotatorController)
            //Maybe we should rather go for a more active approach meaning Rotator gets everything which is gonna rotate around it and rotates it
            #region Wall right Model
            model = this.modelDictionary["wall"];
            transform = new Transform3D(new Vector3(-4f, -1.8f, -69.8f), new Vector3(0, 90, 0), 1f * Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            wall1 = new PawnCollidableObject("Wall1", ObjectType.Wall, transform, this.texturedModelEffect, null, model, Color.Gray, 1);
            wall1.Add(new RotatorController("wall1Rotator", wall1, true, this.rotator));
            scales = new Vector3(300, 100, 12);
            wall1.AddPrimitive(new Box(transform.Translation, Matrix.Identity, scales), material);
            wall1.Enable(true, 2000);

            this.objectManager.Add(wall1);
            #endregion
            #region Wall left Model
            model = this.modelDictionary["wall"];
            transform = new Transform3D(new Vector3(-4f, -1.8f, 69.8f), new Vector3(0,90,0), 1f * Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            wall2 = new PawnCollidableObject("Wall2", ObjectType.Wall, transform, this.texturedModelEffect, null, model, Color.White, 1);
            wall2.Add(new RotatorController("wall2Rotator", wall2, true, this.rotator));
            wall2.AddPrimitive(new Box(transform.Translation, Matrix.Identity, scales), material);
            wall2.Enable(true, 2000);

            this.objectManager.Add(wall2);
            #endregion
            texture = Content.Load<Texture2D>("Assets/skin/Brick_Tut_35");
            #region Pressure Plate Exit Model
            model = this.modelDictionary["plate"];
            scales = new Vector3(12.5f, 2.5f, 12.5f);
            transform = new Transform3D(new Vector3(125, 0, 0), new Vector3(0, 90, 0), Vector3.One * 0.5f, -Vector3.UnitZ, Vector3.UnitY);
            step1 = new PawnCollidableObject("PressurePlate1", ObjectType.Plate, transform, this.texturedModelEffect, texture, model, Color.White, 1);
            step1.AddPrimitive(new Box(transform.Translation, Matrix.Identity, scales), new MaterialProperties());
            step1.Enable(true, 2000);

            this.objectManager.Add(step1);
            #endregion
            #region Pressure Plate Right Up Model
            transform = new Transform3D(new Vector3(26, 0, 110), Vector3.Zero, Vector3.One * 0.5f, -Vector3.UnitZ, Vector3.UnitY);
            step4 = new PawnCollidableObject("PressurePlate4", ObjectType.Plate, transform, this.texturedModelEffect, texture, model, Color.White, 1);
            step4.AddPrimitive(new Box(transform.Translation, Matrix.Identity, scales), new MaterialProperties());
            step4.Enable(true, 2000);

            this.objectManager.Add(step4);
            #endregion
            #region Pressure Plate Right Down Model
            transform = new Transform3D(new Vector3(-36, 0, 110), Vector3.Zero, Vector3.One * 0.5f, -Vector3.UnitZ, Vector3.UnitY);
            step5 = new PawnCollidableObject("PressurePlate5", ObjectType.Plate, transform, this.texturedModelEffect, texture, model, Color.White, 1);
            step5.AddPrimitive(new Box(transform.Translation, Matrix.Identity, scales), new MaterialProperties());
            step5.Enable(true, 2000);

            this.objectManager.Add(step5);
            #endregion
            #region Pressure Plate Left Up Model
            transform = new Transform3D(new Vector3(26, 0, -110), Vector3.Zero, Vector3.One*0.5f, -Vector3.UnitZ, Vector3.UnitY);
            step2 = new PawnCollidableObject("PressurePlate2", ObjectType.Plate, transform, this.texturedModelEffect, null, model, Color.White, 1);
            step2.AddPrimitive(new Box(transform.Translation, Matrix.Identity, scales), new MaterialProperties());
            step2.Enable(true, 2000);

            this.objectManager.Add(step2);
            #endregion
            #region Pressure Plate Left Down Model
            transform = new Transform3D(new Vector3(-36, 0, -110), Vector3.Zero, Vector3.One * 0.5f, -Vector3.UnitZ, Vector3.UnitY);
            step3 = new PawnCollidableObject("PressurePlate3", ObjectType.Plate, transform, this.texturedModelEffect, null, model, Color.White, 1);
            step3.AddPrimitive(new Box(transform.Translation, Matrix.Identity, scales), new MaterialProperties());
            step3.Enable(true, 2000);

            this.objectManager.Add(step3);
            #endregion

            #region Traps
            model = this.modelDictionary["trap"];
            transform = new Transform3D(new Vector3(80, 20f, 105), Vector3.UnitZ * 90, 0.5f * Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            trap1 = new PawnModelObject("PressurePlate1", ObjectType.Plate, transform, this.texturedModelEffect,texture, model, Color.White, 1);
            this.objectManager.Add(trap1);

            transform = new Transform3D(new Vector3(80, 20f, 115), Vector3.UnitZ * 90, 0.5f * Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            trap2 = new PawnModelObject("PressurePlate1", ObjectType.Plate, transform, this.texturedModelEffect, texture, model, Color.White, 1);
            this.objectManager.Add(trap2);

            transform = new Transform3D(new Vector3(80, 20f, -105), Vector3.UnitZ * 90, 0.5f * Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            trap3 = new PawnModelObject("PressurePlate1", ObjectType.Plate, transform, this.texturedModelEffect, texture, model, Color.White, 1);
            this.objectManager.Add(trap3);

            transform = new Transform3D(new Vector3(80, 20f, -115), Vector3.UnitZ * 90, 0.5f * Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            trap4 = new PawnModelObject("PressurePlate1", ObjectType.Plate, transform, this.texturedModelEffect, texture, model, Color.White, 1);
            this.objectManager.Add(trap4);

            transform = new Transform3D(new Vector3(-90, 20f, 105), -Vector3.UnitZ * 90, 0.5f * Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            trap5 = new PawnModelObject("PressurePlate1", ObjectType.Plate, transform, this.texturedModelEffect, texture, model, Color.White, 1);
            this.objectManager.Add(trap5);

            transform = new Transform3D(new Vector3(-90, 20f, 115), -Vector3.UnitZ * 90, 0.5f * Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            trap6 = new PawnModelObject("PressurePlate1", ObjectType.Plate, transform, this.texturedModelEffect, texture, model, Color.White, 1);
            this.objectManager.Add(trap6);

            transform = new Transform3D(new Vector3(-90, 20f, -105), -Vector3.UnitZ * 90, 0.5f * Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            trap7 = new PawnModelObject("PressurePlate1", ObjectType.Plate, transform, this.texturedModelEffect, texture, model, Color.White, 1);
            this.objectManager.Add(trap7);

            transform = new Transform3D(new Vector3(-90, 20f, -115), -Vector3.UnitZ * 90, 0.5f * Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            trap8 = new PawnModelObject("PressurePlate1", ObjectType.Plate, transform, this.texturedModelEffect, texture, model, Color.White, 1);
            this.objectManager.Add(trap8);
            #endregion
            #region Arrow
            model = this.modelDictionary["arrow"];
            transform = new Transform3D(new Vector3(80, 20f, 105), Vector3.UnitZ * 90,  Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            arrow1 = new PawnModelObject("Arrow1", ObjectType.Plate, transform, this.texturedModelEffect, texture, model, Color.White, 1);
            this.objectManager.Add(arrow1);

            transform = new Transform3D(new Vector3(80, 20f, 115), Vector3.UnitZ * 90,  Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            arrow2 = new PawnModelObject("Arrow2", ObjectType.Plate, transform, this.texturedModelEffect, texture, model, Color.White, 1);
            this.objectManager.Add(arrow2);

            transform = new Transform3D(new Vector3(80, 20f, -105), Vector3.UnitZ * 90,  Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            arrow3 = new PawnModelObject("Arrow3", ObjectType.Plate, transform, this.texturedModelEffect, texture, model, Color.White, 1);
            this.objectManager.Add(arrow3);

            transform = new Transform3D(new Vector3(80, 20f, -115), Vector3.UnitZ * 90,  Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            arrow4 = new PawnModelObject("Arrow4", ObjectType.Plate, transform, this.texturedModelEffect, texture, model, Color.White, 1);
            this.objectManager.Add(arrow4);

            transform = new Transform3D(new Vector3(-90, 20f, 105), -Vector3.UnitZ * 90,  Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            arrow5 = new PawnModelObject("Arrow5", ObjectType.Plate, transform, this.texturedModelEffect, texture, model, Color.White, 1);
            this.objectManager.Add(arrow5);

            transform = new Transform3D(new Vector3(-90, 20f, 115), -Vector3.UnitZ * 90,  Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            arrow6 = new PawnModelObject("Arrow6", ObjectType.Plate, transform, this.texturedModelEffect, texture, model, Color.White, 1);
            this.objectManager.Add(arrow6);

            transform = new Transform3D(new Vector3(-90, 20f, -105), -Vector3.UnitZ * 90,  Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            arrow7 = new PawnModelObject("Arrow7", ObjectType.Plate, transform, this.texturedModelEffect, texture, model, Color.White, 1);
            this.objectManager.Add(arrow7);

            transform = new Transform3D(new Vector3(-90, 20f, -115), -Vector3.UnitZ * 90, Vector3.One, -Vector3.UnitZ, Vector3.UnitY);
            arrow8 = new PawnModelObject("Arrow8", ObjectType.Plate, transform, this.texturedModelEffect, texture, model, Color.White, 1);
            this.objectManager.Add(arrow8);

            scales = new Vector3(300, 100, 20);
            #endregion

            rotator.Add(new OffsetController("offset controller 2", rotator, true, new Vector3(0, 50, 0)));
            rotator.Add(new RotorController("rotor Controller", this.rotator, true));
            doorActor.Add(new OffsetController("offset vontroller 7", doorActor, true, new Vector3(0, -110, 0)));
            step1.Add(new OffsetController("offset controller 1", step1, true, new Vector3(0, -3, 0)));
            step2.Add(new OffsetController("offset controller 3", step2, true, new Vector3(0, -3, 0)));
            step3.Add(new OffsetController("offset controller 4", step3, true, new Vector3(0, -3, 0)));
            step4.Add(new OffsetController("offset controller 5", step4, true, new Vector3(0, -3, 0)));
            step5.Add(new OffsetController("offset controller 6", step5, true, new Vector3(0, -3, 0)));
            trap1.Add(new OffsetController("offset controller 7", trap1, true, new Vector3(-20, 0, 0)));
            trap2.Add(new OffsetController("offset controller 8", trap2, true, new Vector3(-20, 0, 0)));
            trap3.Add(new OffsetController("offset controller 9", trap3, true, new Vector3(-20, 0, 0)));
            trap4.Add(new OffsetController("offset controller 10", trap4, true, new Vector3(-20, 0, 0)));
            trap5.Add(new OffsetController("offset controller 11", trap5, true, new Vector3(20, 0, 0)));
            trap6.Add(new OffsetController("offset controller 12", trap6, true, new Vector3(20, 0, 0)));
            trap7.Add(new OffsetController("offset controller 13", trap7, true, new Vector3(20, 0, 0)));
            trap8.Add(new OffsetController("offset controller 14", trap8, true, new Vector3(20, 0, 0)));
            arrow1.Add(new OffsetController("offset controller 7", arrow1, true, new Vector3(-200, 0, 0), 0.2f));
            arrow2.Add(new OffsetController("offset controller 8", arrow2, true, new Vector3(-200, 0, 0), 0.2f));
            arrow3.Add(new OffsetController("offset controller 9", arrow3, true, new Vector3(-200, 0, 0), 0.2f));
            arrow4.Add(new OffsetController("offset controller 10", arrow4, true, new Vector3(-200, 0, 0), 0.2f));
            arrow5.Add(new OffsetController("offset controller 11", arrow5, true, new Vector3(200, 0, 0), 0.2f));
            arrow6.Add(new OffsetController("offset controller 12", arrow6, true, new Vector3(200, 0, 0), 0.2f));
            arrow7.Add(new OffsetController("offset controller 13", arrow7, true, new Vector3(200, 0, 0), 0.2f));
            arrow8.Add(new OffsetController("offset controller 14", arrow8, true, new Vector3(200, 0, 0), 0.2f));
        }
示例#19
0
        public void CreateBox(Vector3 position, Matrix orientation, Vector3 length)
        {
            this.collisionSkin = new CollisionSkin(this.Body);

            Box primitiveBox = new Box(position, orientation, length);

            MaterialProperties materialProp = new MaterialProperties(
                elasticity, staticRoughness, dynamicRoughness);

            CollisionSkin.AddPrimitive(primitiveBox, materialProp);

            SetupProperty(position, orientation);
        }
 public void AddPrimitive(Primitive primitive, MaterialProperties materialProperties)
 {
     this.collision.AddPrimitive(primitive, materialProperties);
 }
示例#21
0
 /// <summary>
 /// Sets the material properties for a primitive. In this case the
 /// material ID will be automatically set to USER_DEFINED
 /// </summary>
 /// <param name="prim"></param>
 /// <param name="matProperties"></param>
 public void SetMaterialProperties(int prim, MaterialProperties matProperties)
 {
     materialProperties[prim] = matProperties;
     materialIDs[prim]        = (int)MaterialTable.MaterialID.UserDefined;
 }
示例#22
0
        public void AddPhysicsPrimitive(Primitive geom, MaterialProperties properties)
        {
            m_skin.AddPrimitive(geom, properties);

            ResetSkinAndMass();
        }