当前位置: 首页>>代码示例>>C#>>正文


C# SceneNode.SetPosition方法代码示例

本文整理汇总了C#中SceneNode.SetPosition方法的典型用法代码示例。如果您正苦于以下问题:C# SceneNode.SetPosition方法的具体用法?C# SceneNode.SetPosition怎么用?C# SceneNode.SetPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SceneNode的用法示例。


在下文中一共展示了SceneNode.SetPosition方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Barrel

 public Barrel(string meshName, Vector3 v, float mass)
 {
     m_Entity = Core.Singleton.SceneManager.CreateEntity(meshName);
     m_Node = Core.Singleton.SceneManager.RootSceneNode.CreateChildSceneNode();
     m_Node.AttachObject(m_Entity);
     m_Node.Scale(0.1f, 0.1f, 0.1f);
     m_Node.Scale(new Vector3(0.3f, 0.3f, 0.3f));
     // m_Node.Rotate(new Mogre.Quaternion(new Mogre.Radian(1.57f), new Mogre.Vector3(0f, 0f, 1f) ));
     m_Node.SetPosition(v.x, v.y, v.z);
     SetPhysics(m_Entity, m_Node, mass);
 }
开发者ID:secred,项目名称:Tachycardia,代码行数:11,代码来源:Barrel.cs

示例2: Elevator

 public Elevator(string meshName, float mass, Vector3 v, bool flaga)
 {
     //tworzy grafike playera i podczepia mu kontroler, obsluguje animacje i uaktualnia kontroler
     m_HeadOffset = new Vector3(0, 0.1f, 0);
     //headoffset powinien byc chyba zmienny dla croucha itp
     m_Entity = Core.Singleton.SceneManager.CreateEntity(meshName);
     m_Node = Core.Singleton.SceneManager.RootSceneNode.CreateChildSceneNode();
     m_Node.AttachObject(m_Entity);
     m_Node.Rotate(new Mogre.Quaternion(new Mogre.Radian(Mogre.Math.RadiansToDegrees(20)), new Mogre.Vector3(0f, 1f, 0f)));
     m_Node.SetPosition(v.x, v.y, v.z);
     SetPhysics(m_Entity, m_Node, mass);
 }
开发者ID:secred,项目名称:Tachycardia,代码行数:12,代码来源:Elevator.cs

示例3: SetGrid

        public void SetGrid()
        {
            mainGrid = sceneMgr.RootSceneNode.CreateChildSceneNode("mainGrid_node");
            mainGrid.SetPosition(0, -0.05f, 0);
            mainGrid.AttachObject(CreateGrid(sceneMgr, 30f, 1f, "main"));

            mainGrid.SetVisible(false);
        }
开发者ID:realmzero,项目名称:RZModelViewer,代码行数:8,代码来源:OgreWindow.cs

示例4: CreateScene

        protected override void CreateScene()
        {
            // Set ambient light
            sceneMgr.AmbientLight = new ColourValue(0.75f, 0.75f, 0.75f);

            // Create a light
            Light l = sceneMgr.CreateLight("MainLight");
            // Accept default settings: point light, white diffuse, just set position
            // NB I could attach the light to a SceneNode if I wanted it to move automatically with
            //  other objects, but I don't
            l.Position = new Vector3(200, 700, 100);

            sceneMgr.ShadowTechnique = ShadowTechnique.SHADOWTYPE_TEXTURE_MODULATIVE;

            // Create a skydome
            sceneMgr.SetSkyDome(true, "Examples/CloudySky", 30, 5);

            // Put in a bit of fog for the hell of it
            sceneMgr.SetFog(FogMode.FOG_EXP, ColourValue.White, 0.0001f, 0.5f);

            // Define a floor plane mesh
            Plane p = new Plane();
            p.normal = Vector3.UNIT_Y;
            p.d = 180;
            MeshManager.Singleton.CreatePlane("FloorPlane",
                ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME,
                p, PLANE_SIZE * 1000, PLANE_SIZE * 1000, 20, 20, true, 1, 50, 50, Vector3.UNIT_Z);

            Entity ent = sceneMgr.CreateEntity("floorEntity", "FloorPlane");
            ent.SetMaterialName("Examples/RustySteel");
            ent.CastShadows = false;
            SceneNode floorNode = sceneMgr.RootSceneNode.CreateChildSceneNode("floorSceneNode");
            floorNode.AttachObject(ent);

            // Add a head, give it it's own node
            // The Ogre head faces to Z
            headNode = sceneMgr.RootSceneNode.CreateChildSceneNode("headSceneNode");
            ent = sceneMgr.CreateEntity("head", "ogrehead.mesh");
            ent.CastShadows = true;
            headNode.AttachObject(ent);

            atheneNode = sceneMgr.RootSceneNode.CreateChildSceneNode("atheneSceneNode");
            //Entity *Athene = mSceneMgr->createEntity( "Razor", "razor.mesh" );
            Entity Athene = sceneMgr.CreateEntity("Athene", "athene.mesh");
            Athene.SetMaterialName("Examples/Athene/NormalMapped");
            Athene.CastShadows = true;
            atheneNode.AttachObject(Athene);
            atheneNode.SetPosition(500, -100, 500);

            // Obstacle for collisions detection
            SceneNode barrelNode = sceneMgr.RootSceneNode.CreateChildSceneNode("barrelSceneNode");
            Entity barrel = sceneMgr.CreateEntity("barrel", "barrel.mesh");
            barrel.CastShadows = true;
            barrelNode.AttachObject(barrel);
            barrelNode.SetPosition(1300, -100, 500);
            barrelNode.SetScale(40, 40, 40);

            // Create light node
            SceneNode lightNode = sceneMgr.RootSceneNode.CreateChildSceneNode("lightSceneNode");
            lightNode.AttachObject(l);
            goto cameraControl;

            // set up spline animation of node
            Animation anim = sceneMgr.CreateAnimation("HeadTrack", 20);
            // Spline it for nice curves

            anim.SetInterpolationMode(Mogre.Animation.InterpolationMode.IM_SPLINE);
            // Create a track to animate the camera's node
            NodeAnimationTrack track = anim.CreateNodeTrack(0, headNode);
            // Setup keyframes
            TransformKeyFrame key = track.CreateNodeKeyFrame(0); // startposition
            key.Translate = new Vector3(0, 0, 0);
            key.Rotation = Quaternion.IDENTITY;

            key = track.CreateNodeKeyFrame(2.5f);
            key.Translate = new Vector3(0, 0, 1000);
            key.Rotation = Vector3.UNIT_Z.GetRotationTo(new Vector3(1000, 0, 1000));

            key = track.CreateNodeKeyFrame(5);
            key.Translate = new Vector3(1000, 0, 1000);
            key.Rotation = Vector3.UNIT_Z.GetRotationTo(new Vector3(1000, 0, 0));

            key = track.CreateNodeKeyFrame(7.5f);
            key.Translate = new Vector3(1000, 0, 0);
            key.Rotation = Vector3.UNIT_Z.GetRotationTo(Vector3.NEGATIVE_UNIT_X);

            key = track.CreateNodeKeyFrame(10);
            key.Translate = new Vector3(0, 0, 0);

            // Second round
            key = track.CreateNodeKeyFrame(11);
            key.Translate = new Vector3(0, 0, 400);
            key.Rotation = new Quaternion(new Radian(3.14f / 4.0f), Vector3.UNIT_Z);

            key = track.CreateNodeKeyFrame(11.5f);
            key.Translate = new Vector3(0, 0, 600);
            key.Rotation = new Quaternion(new Radian(-3.14f / 4.0f), Vector3.UNIT_Z);

            key = track.CreateNodeKeyFrame(12.5f);
            key.Translate = new Vector3(0, 0, 1000);
//.........这里部分代码省略.........
开发者ID:andyhebear,项目名称:Mccs,代码行数:101,代码来源:CameraControlSystemDemo.cs


注:本文中的SceneNode.SetPosition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。