//how do we want this object to respond to collisions?
 private void HandleCollisions(CollidableObject collidableObjectCollider, CollidableObject collidableObjectCollidee)
 {
     ////add your response code here...
     //if(collidableObjectCollider.ActorType == ActorType.Player)
     //{
     //    EventDispatcher.Publish(new EventData(this, EventActionType.OnRemoveActor, EventCategoryType.SystemRemove));
     //}
 }
예제 #2
0
 //debug method to draw collision skins for collidable objects and zone objects
 private void DebugDrawCollisionSkin(IActor actor)
 {
     if ((actor is CollidableObject) && (this.IsDebugMode))
     {
         CollidableObject collidableObject = actor as CollidableObject;
         this.game.PhysicsManager.DebugDrawer.DrawDebug(collidableObject.Body, collidableObject.Collision);
     }
 }
        public static bool IsCollidableObjectPlayer(CollidableObject collidableObject)
        {
            //shouldnt be able to pick immovable things
            if (collidableObject.Collision.Owner.Immovable)
            {
                return(false);
            }

            return(collidableObject.ActorType == ActorType.Player);
        }
        //a predicate function to be used by PickingManager for ray picking of collidable objects - defines what types are valid
        public static bool IsCollidableObjectOfInterest(CollidableObject collidableObject)
        {
            //shouldnt be able to pick immovable things
            if (collidableObject.Collision.Owner.Immovable)
            {
                return(false);
            }

            return(collidableObject.ActorType == ActorType.CollidableProp || collidableObject.ActorType == ActorType.CollidablePickup);
        }
 //debug method to draw collision skins for collidable objects and zone objects
 private void DrawCollisionSkin(IActor actor)
 {
     if (this.bDebugMode && actor is CollidableObject)
     {
         CollidableObject collidableObject = actor as CollidableObject;
         this.Game.PhysicsManager.DebugDrawer.DrawDebug(collidableObject.Body, collidableObject.Collision, collidableObject.Color);
     }
     else if (this.bShowZones && actor is ZoneObject)
     {
         ZoneObject zoneObject = actor as ZoneObject;
         this.Game.PhysicsManager.DebugDrawer.DrawDebug(zoneObject.Body, zoneObject.Collision, zoneObject.Color);
     }
 }
예제 #6
0
        private void DoPickAndRemove(GameTime gameTime)
        {
            if (this.inputManagerParameters.MouseManager.IsLeftButtonClickedOnce())
            {
                this.camera = this.cameraManager.ActiveCamera;
                this.currentPickedObject = this.inputManagerParameters.MouseManager.GetPickedObject(camera, camera.ViewportCentre,
                                                                                                    this.pickStartDistance, this.pickEndDistance, out pos, out normal) as CollidableObject;

                if (this.currentPickedObject != null && IsValidCollision(currentPickedObject, pos, normal))
                {
                    //generate event to tell object manager and physics manager to remove the object
                    EventDispatcher.Publish(new EventData(this.currentPickedObject, EventActionType.OnRemoveActor, EventCategoryType.SystemRemove));
                }
            }
        }
        public void AddCollisionSkinVertexData(CollidableObject collidableObject)
        {
            if (!collidableObject.Body.CollisionSkin.GetType().Equals(typeof(JigLibX.Geometry.Plane)))
            {
                wf = collidableObject.Collision.GetLocalSkinWireframe();

                // if the collision skin was also added to the body
                // we have to transform the skin wireframe to the body space
                if (collidableObject.Body.CollisionSkin != null)
                {
                    collidableObject.Body.TransformWireframe(wf);
                }

                AddVertexDataForShape(wf, collidableObject.EffectParameters.DiffuseColor);
            }
        }
 //call when we want to remove a drawn object from the scene
 public void Remove(CollidableObject collidableObject)
 {
     this.removeList.Add(collidableObject);
 }
예제 #9
0
        private void DoPickAndPlace(GameTime gameTime)
        {
            if (this.inputManagerParameters.MouseManager.IsMiddleButtonClicked())
            {
                if (!this.bCurrentlyPicking)
                {
                    this.camera = this.cameraManager.ActiveCamera;
                    this.currentPickedObject = this.inputManagerParameters.MouseManager.GetPickedObject(camera, camera.ViewportCentre,
                                                                                                        this.pickStartDistance, this.pickEndDistance, out pos, out normal) as CollidableObject;

                    this.distanceToObject = (float)Math.Round(Vector3.Distance(camera.Transform.Translation, pos), DefaultDistanceToTargetPrecision);

                    if (this.currentPickedObject != null && IsValidCollision(currentPickedObject, pos, normal))
                    {
                        Vector3 vectorDeltaFromCentreOfMass = pos - this.currentPickedObject.Collision.Owner.Position;
                        vectorDeltaFromCentreOfMass = Vector3.Transform(vectorDeltaFromCentreOfMass, Matrix.Transpose(this.currentPickedObject.Collision.Owner.Orientation));
                        cameraPickDistance          = (this.cameraManager.ActiveCamera.Transform.Translation - pos).Length();

                        //remove any controller from any previous pick-release
                        objectController.Destroy();
                        damperController.Destroy();

                        this.currentPickedObject.Collision.Owner.SetActive();
                        //move object by pos (i.e. point of collision and not centre of mass)
                        this.objectController.Initialise(this.currentPickedObject.Collision.Owner, vectorDeltaFromCentreOfMass, pos);
                        //dampen velocity (linear and angular) on object to Zero
                        this.damperController.Initialise(this.currentPickedObject.Collision.Owner, ConstraintVelocity.ReferenceFrame.Body, Vector3.Zero, Vector3.Zero);
                        this.objectController.EnableConstraint();
                        this.damperController.EnableConstraint();
                        //we're picking a valid object for the first time
                        this.bCurrentlyPicking = true;

                        //update mouse text
                        object[] additionalParameters = { currentPickedObject, this.distanceToObject };
                        EventDispatcher.Publish(new EventData(EventActionType.OnObjectPicked, EventCategoryType.ObjectPicking, additionalParameters));
                    }
                }

                //if we have an object picked from the last update then move it according to the mouse pointer
                if (objectController.IsConstraintEnabled && (objectController.Body != null))
                {
                    // Vector3 delta = objectController.Body.Position - this.managerParameters.CameraManager.ActiveCamera.Transform.Translation;
                    Vector3 direction = this.inputManagerParameters.MouseManager.GetMouseRay(this.cameraManager.ActiveCamera).Direction;
                    cameraPickDistance += this.inputManagerParameters.MouseManager.GetDeltaFromScrollWheel() * 0.1f;
                    Vector3 result = this.cameraManager.ActiveCamera.Transform.Translation + cameraPickDistance * direction;
                    //set the desired world position
                    objectController.WorldPosition = this.cameraManager.ActiveCamera.Transform.Translation + cameraPickDistance * direction;
                    objectController.Body.SetActive();
                }
            }
            else //releasing object
            {
                if (this.bCurrentlyPicking)
                {
                    //release object from constraints and allow to behave as defined by gravity etc
                    objectController.DisableConstraint();
                    damperController.DisableConstraint();

                    //notify listeners that we're no longer picking
                    object[] additionalParameters = { NoObjectSelectedText };
                    EventDispatcher.Publish(new EventData(EventActionType.OnNonePicked, EventCategoryType.ObjectPicking, additionalParameters));

                    this.bCurrentlyPicking = false;
                }
            }
        }
예제 #10
0
 //called when over collidable/pickable object
 protected virtual bool IsValidCollision(CollidableObject collidableObject, Vector3 pos, Vector3 normal)
 {
     //if not null then call method to see if its an object that conforms to our predicate (e.g. ActorType::CollidablePickup), otherwise return false
     return((collidableObject != null) ? this.collisionPredicate(collidableObject) : false);
 }
        public virtual void DoMousePick(GameTime gameTime)
        {
            if (game.CameraManager.ActiveCamera != null)
            {
                float   distance = 7;
                float   startDistance = 1; //if 1st person collidable then start picking outside CD/CR surface
                Vector3 pos, normal;

                //add code for mouse picking from the previous week....
                CollidableObject collidableObject = game.MouseManager.GetPickedObjectFromCenter(
                    game.CameraManager.ActiveCamera,
                    startDistance, distance, out pos, out normal) as CollidableObject;

                if (collidableObject != null) //&& (collidableObject.ActorType == ActorType.Pickup))
                {
                    this.Text = collidableObject.ID;

                    if (collidableObject.ActorType == ActorType.CollidableInteractableProp)
                    {
                        text += " : Interactable Object";
                        this.textDimensions        = this.spriteFont.MeasureString(this.text);
                        this.textOrigin            = new Vector2(this.textDimensions.X / 2, this.textDimensions.Y / 2);
                        textColor                  = Color.DeepPink;
                        this.Color                 = Color.DeepPink;
                        this.Transform2D.Rotation += 0.05f;

                        if (game.MouseManager.IsLeftButtonClickedOnce() || game.KeyboardManager.IsFirstKeyPress(Microsoft.Xna.Framework.Input.Keys.E))
                        {
                            //call event on interaction
                            // PickupCollidableObject pickupObject = collidableObject as PickupCollidableObject;
                            // EventDispatcher.Publish(pickupObject.EventParameters.EventData);
                            if (collidableObject.ID == "door" && game.playerHasKey)
                            {
                                EventDispatcher.Publish(new EventData("Locks Door", this, EventActionType.WinGame, EventCategoryType.Interaction));
                                collidableObject.ActorType = ActorType.Decorator;
                            }
                            if (collidableObject.ID == "phone")
                            {
                                EventDispatcher.Publish(new EventData("Phone", this, EventActionType.PhoneInteraction, EventCategoryType.Interaction));
                            }
                            if (collidableObject.ID == "clock")
                            {
                                EventDispatcher.Publish(new EventData("Clock", this, EventActionType.ClockInteraction, EventCategoryType.Interaction));
                            }
                            if (collidableObject.ID == "painting1")
                            {
                                EventDispatcher.Publish(new EventData("painting1", this, EventActionType.PaintingGoodInteraction, EventCategoryType.Interaction));
                                collidableObject.ActorType = ActorType.Decorator;
                            }
                            if (collidableObject.ID == "painting2")
                            {
                                EventDispatcher.Publish(new EventData("painting2", this, EventActionType.PaintingOtherInteraction, EventCategoryType.Interaction));
                                collidableObject.ActorType = ActorType.Decorator;
                            }
                            if (collidableObject.ID == "painting3")
                            {
                                EventDispatcher.Publish(new EventData("painting3", this, EventActionType.PaintingBadInteraction, EventCategoryType.Interaction));
                                collidableObject.ActorType = ActorType.Decorator;
                            }
                            if (collidableObject.ID == "kettle")
                            {
                                EventDispatcher.Publish(new EventData("Kettle", this, EventActionType.KettleInteraction, EventCategoryType.Interaction));
                                collidableObject.ActorType = ActorType.Decorator;
                            }
                            if (collidableObject.ID == "microwave")
                            {
                                EventDispatcher.Publish(new EventData("Microwave", this, EventActionType.MicrowaveInteraction, EventCategoryType.Interaction));
                                collidableObject.ActorType = ActorType.Decorator;
                            }
                            if (collidableObject.ID == "chair")
                            {
                                EventDispatcher.Publish(new EventData("Chair", this, EventActionType.ChairInteraction, EventCategoryType.Interaction));
                                collidableObject.ActorType = ActorType.Decorator;
                            }
                            if (collidableObject.ID == "toaster")
                            {
                                EventDispatcher.Publish(new EventData("Toaster", this, EventActionType.ToasterInteraction, EventCategoryType.Interaction));
                                collidableObject.ActorType = ActorType.Decorator;
                            }
                            if (collidableObject.ID == "fridge")
                            {
                                EventDispatcher.Publish(new EventData("Fridge", this, EventActionType.FridgeInteraction, EventCategoryType.Interaction));
                                collidableObject.ActorType = ActorType.Decorator;
                            }
                            if (collidableObject.ID == "oven")
                            {
                                EventDispatcher.Publish(new EventData("Oven", this, EventActionType.OvenInteraction, EventCategoryType.Interaction));
                                collidableObject.ActorType = ActorType.Decorator;
                            }
                            if (collidableObject.ID == "sink")
                            {
                                EventDispatcher.Publish(new EventData("Sink", this, EventActionType.SinkInteraction, EventCategoryType.Interaction));
                                collidableObject.ActorType = ActorType.Decorator;
                            }
                            if (collidableObject.ID == "mirror")
                            {
                                EventDispatcher.Publish(new EventData("Mirror", this, EventActionType.MirrorInteraction, EventCategoryType.Interaction));
                                collidableObject.ActorType = ActorType.Decorator;
                            }
                            if (collidableObject.ID == "toilet")
                            {
                                EventDispatcher.Publish(new EventData("Toilet", this, EventActionType.ToiletInteraction, EventCategoryType.Interaction));
                                collidableObject.ActorType = ActorType.Decorator;
                            }
                            if (collidableObject.ID == "radio")
                            {
                                EventDispatcher.Publish(new EventData("Radio", this, EventActionType.RadioInteraction, EventCategoryType.Interaction));
                            }
                            if (collidableObject.ID == "tv")
                            {
                                EventDispatcher.Publish(new EventData("Television", this, EventActionType.TVInteraction, EventCategoryType.Interaction));
                                collidableObject.ActorType = ActorType.Decorator;
                            }
                            if (collidableObject.ID == "remote")
                            {
                                EventDispatcher.Publish(new EventData("Remote", this, EventActionType.RemoteInteraction, EventCategoryType.Interaction));
                                collidableObject.ActorType = ActorType.Decorator;
                            }
                            if (collidableObject.ID == "winebottle")
                            {
                                EventDispatcher.Publish(new EventData("Vino", this, EventActionType.VinoInteraction, EventCategoryType.Interaction));
                                collidableObject.ActorType = ActorType.Decorator;
                            }
                        }
                    }
                    else if (collidableObject.ActorType == ActorType.Pickup)
                    {
                        text += " : Pickup";
                        this.textDimensions        = this.spriteFont.MeasureString(this.text);
                        this.textOrigin            = new Vector2(this.textDimensions.X / 2, this.textDimensions.Y / 2);
                        textColor                  = Color.Yellow;
                        this.Transform2D.Rotation -= 0.05f;
                        this.Color                 = Color.Yellow;
                        if (game.MouseManager.IsLeftButtonClickedOnce() || game.KeyboardManager.IsFirstKeyPress(Microsoft.Xna.Framework.Input.Keys.E))
                        {
                            if (collidableObject.ID == "key")
                            {
                                /* bool aniRun = true;
                                 * collidableObject.AttachController(new KeyPickupController("keyPick",
                                 *   ControllerType.KeyPickupController, new Vector3(0, .01f, 0),
                                 *   new Vector3(.01f, 0, .01f)));
                                 * long startTime = gameTime.ElapsedGameTime.Milliseconds;
                                 * long currentTime;
                                 * long endTime = startTime + 3500;
                                 * while (aniRun)
                                 * {
                                 *   currentTime = gameTime.ElapsedGameTime.Milliseconds;
                                 *   if (currentTime >= endTime)
                                 *   {
                                 *       aniRun = false;
                                 *       //collidableObject.DetachController("keyPick");
                                 *       game.ObjectManager.Remove(collidableObject);
                                 *
                                 *   }
                                 * }*/
                                game.ObjectManager.Remove(collidableObject);
                                EventDispatcher.Publish(new EventData("Has Key", this, EventActionType.PickUpKey, EventCategoryType.Interaction));
                                collidableObject.ActorType = ActorType.Decorator;
                            }

                            //call event on pickup
                            // PickupCollidableObject pickupObject = collidableObject as PickupCollidableObject;
                            // EventDispatcher.Publish(pickupObject.EventParameters.EventData);
                        }
                    }
                    else
                    {
                        text       = "";
                        textColor  = Color.White;
                        this.Color = Color.White;
                        this.Transform2D.Rotation = 0;
                        //do something when not colliding...
                    }
                }
                else
                {
                    text       = "";
                    textColor  = Color.White;
                    this.Color = Color.White;
                    this.Transform2D.Rotation = 0;
                    //do something when not colliding...
                }
            }
        }
예제 #12
0
        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));
        }
 public static string GetMouseStringFromCollidableObject(CollidableObject collidableObject, float distanceToObject)
 {
     return(collidableObject.ID + " [" + distanceToObject + "]");
 }
 //how do we want this object to respond to collisions?
 private void HandleCollisions(CollidableObject collidableObjectCollider, CollidableObject collidableObjectCollidee)
 {
     //add your response code here...
 }