SetPosition() public method

public SetPosition ( System.Vector3 position ) : void
position System.Vector3
return void
Beispiel #1
0
        static void Main(string[] args)
        {
            Core.Singleton.Initialise();
            Core.Singleton.m_CurrentMap = new Map();
            Core.Singleton.m_CurrentMap.SetGraphicsMesh("Level.mesh");
            Core.Singleton.m_CurrentMap.SetCollisionMesh("LevelCol.mesh");

            CharacterProfile profile = new CharacterProfile();
            profile.m_BodyMass = 70;
            profile.m_BodyScaleFactor = new Vector3(1.5f, 1, 1.5f);
            profile.m_HeadOffset = new Vector3(0, 0.8f, 0);
            profile.m_MeshName = "Man.mesh";
            profile.m_WalkSpeed = 2.5f;

            Character player = new Character(profile);
            player.SetPosition(new Vector3(0, 2, 0));
            Core.Singleton.m_ObjectManager.Add(player);

            Core.Singleton.m_GameCamera.Character = player;
            Core.Singleton.m_GameCamera.Distance = 4;
            Core.Singleton.m_GameCamera.Angle = new Degree(20);

            Light light = Core.Singleton.m_SceneManager.CreateLight();
            light.Type = Light.LightTypes.LT_DIRECTIONAL;
            light.Direction = new Vector3(1, -3, 1).NormalisedCopy;
            light.DiffuseColour = new ColourValue(0.2f, 0.2f, 0.2f);

            Core.Singleton.m_SceneManager.ShadowTechnique = ShadowTechnique.SHADOWTYPE_STENCIL_MODULATIVE;

            while (true)
            {
                Quaternion rotation = new Quaternion();
                rotation.FromAngleAxis(new Degree(120 * Core.Singleton.m_TimeStep), Vector3.UNIT_Y);
                Core.Singleton.Update();

                if (Core.Singleton.m_Keyboard.IsKeyDown(MOIS.KeyCode.KC_ESCAPE))
                    break;

                if (Core.Singleton.m_Keyboard.IsKeyDown(MOIS.KeyCode.KC_A))
                    player.m_Orientation *= Vector3.UNIT_Z.GetRotationTo(new Vector3(0.01f, 0, 1.0f).NormalisedCopy);
                if (Core.Singleton.m_Keyboard.IsKeyDown(MOIS.KeyCode.KC_D))
                    player.m_Orientation *= Vector3.UNIT_Z.GetRotationTo(new Vector3(-0.01f, 0, 1.0f).NormalisedCopy);
                if (Core.Singleton.m_Keyboard.IsKeyDown(MOIS.KeyCode.KC_W))
                    player.m_State = Character.CharacterState.WALK;
                else
                    player.m_State = Character.CharacterState.IDLE;

                if (Core.Singleton.m_Keyboard.IsKeyDown(MOIS.KeyCode.KC_F3))
                    Core.Singleton.m_NewtonDebugger.ShowDebugInformation();
                else
                    Core.Singleton.m_NewtonDebugger.HideDebugInformation();
            }
        }
Beispiel #2
0
        private void CreateOgitorScene()
        {
            m_Log.LogMessage("Creating Default scene...");
            m_CurrentMap = new Map();

            m_Log.LogMessage("Loading scene data...");
            Helper.DotSceneLoader dsl = new Helper.DotSceneLoader();
            dsl.ParseDotScene("default.scene", "Scenes", m_SceneManager);
            m_Log.LogMessage("Scene data loaded.");

            m_BasicController = new MSkyX.BasicController();
            m_SkyX = new MSkyX.MSkyX(m_SceneManager, m_RenderWindow, m_BasicController);
            m_SkyX.Create();
            m_SkyX.Autoupdate = true;

            // AttachHydrax();

            /*m_Log.LogMessage("Creating character profile...");
            CharacterProfile profile = new CharacterProfile();
            profile.m_BodyMass = 70;
            profile.m_BodyScaleFactor = new Vector3(1.5f, 1, 1.5f);
            profile.m_HeadOffset = new Vector3(0, 0.8f, 0);
            profile.m_MeshName = "Man.mesh";
            m_Log.LogMessage("Character profile created.");

            m_Log.LogMessage("Creating player...");
            Character player = new Character(profile);
            player.SetPosition(new Vector3(0, 2, 0));
            m_ObjectManager.Add("player", player);
            m_Log.LogMessage("Player created.");*/

            //z pominieciem profilu, jezeli mi ktos przedstawi jaki byl glebszy sens tego to wrocimy
            m_Log.LogMessage("Creating player...");
            Character player = new Character("Man.mesh", 70);//tworzenie grafiki
            //player.SetPosition(new Vector3(-160f, -25f, 15.5f));
            player.SetPosition(new Vector3(-148, -25, 15));
            m_ObjectManager.Add("player", player);
            m_Log.LogMessage("Player created.");

            CreateElevator();

            // NPCs:
            for (int i = 0; i < 50; i++)
            {
                player = new Character("Man.mesh", 70, true);
                player.SetPosition(new Vector3(-50 + Rand.Next() % 100, 0, -50 + Rand.Next() % 100));
                m_ObjectManager.Add("bot" + i.ToString(), player);
            }

            m_Log.LogMessage("Adding light...");
            Light light = Core.Singleton.SceneManager.CreateLight();
            light.Type = Light.LightTypes.LT_DIRECTIONAL;
            light.Direction = new Vector3(1, -3, 1).NormalisedCopy;
            light.DiffuseColour = new ColourValue(0.2f, 0.2f, 0.2f);
            m_Log.LogMessage("Light added.");

            m_SceneManager.ShadowTechnique = ShadowTechnique.SHADOWTYPE_TEXTURE_MODULATIVE;
            m_Log.LogMessage("Default scene created.");

            //overlays
            //m_Log.LogMessage("Creating an overlay...");
            //var overlay = OverlayManager.Singleton.GetByName("TestScriptOverlay");
            //overlay.Show();

            //overlaye na klawisz: Enter i R wlacza, T wylacza
            m_Keyboard.KeyPressed += new MOIS.KeyListener.KeyPressedHandler(KeyPressedHandler);
            m_Keyboard.KeyReleased += new MOIS.KeyListener.KeyReleasedHandler(KeyReleasedHandler);
        }