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


C# SceneNode.Rotate方法代码示例

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


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

示例1: 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

示例2: setupTapMotion


//.........这里部分代码省略.........
            mNode = mSceneManager.RootSceneNode.CreateChildSceneNode("WiimoteNode",
                new Vector3(0f, 0f, 0f));

            SceneNode l_WimmoteTapMotionNode = mNode.CreateChildSceneNode("WiimoteTapMotionNode",
                new Vector3(0f, 0f, 0f));

            SceneNode l_Wiimote1LineNode = l_WimmoteTapMotionNode.CreateChildSceneNode("Wiimote1LineNode",
                new Vector3(0f, 0f, 0f));
            drawLine(l_Wiimote1LineNode, "Wiimote1LineNode", new Vector3(0f, l_StartingYPosition, l_StartingZPosition),
                new Vector3(0f, l_EndingYPosition, l_EndingZPosition));
            SceneNode l_Wiimote1LineShoeNode = l_Wiimote1LineNode.CreateChildSceneNode("Wiimote1LineShoeNode", new Vector3(0f, l_EndingYPosition / 8, l_EndingZPosition / 8));
            drawCircle(l_Wiimote1LineShoeNode, "WiimoteLine1Shoe");
            l_Wiimote1LineNode.Translate(l_Wiimote1XPosition, 0f, 0f);
            l_Wiimote1LineNode.Translate(0, 0f, 0f);

            SceneNode l_Wiimote2LineNode = l_WimmoteTapMotionNode.CreateChildSceneNode("Wiimote2LineNode",
                new Vector3(0f, 0f, 0f));
            drawLine(l_Wiimote2LineNode, "Wiimote2LineNode", new Vector3(0, l_StartingYPosition, l_StartingZPosition),
                new Vector3(0, l_EndingYPosition, l_EndingZPosition));
            SceneNode l_Wiimote2LineShoeNode = l_Wiimote2LineNode.CreateChildSceneNode("Wiimote2LineShoeNode", new Vector3(0f, l_EndingYPosition / 8, l_EndingZPosition / 8));
            drawCircle(l_Wiimote2LineShoeNode, "WiimoteLine2Shoe");
            l_Wiimote2LineNode.Translate(l_Wiimote2XPosition, 0f, 0f);

            mWiimote1SceneNode = l_Wiimote1LineShoeNode.CreateChildSceneNode("Wiimote1SceneNode",
                new Vector3(0f, 0f, 0f));

            mWiimote2SceneNode = l_Wiimote2LineShoeNode.CreateChildSceneNode("Wiimote2SceneNode",
                new Vector3(0f, 0f, 0f));

            WiimoteOrgeControlCSVParser l_Parser = new WiimoteOrgeControlCSVParser();
            l_Parser.loadShapeData(mDynamicShapes);

            int l_ShapeIndex = 0;
            SceneNode l_SceneNode = null;

            Mogre.Degree l_ShoeYawAngle = new Mogre.Degree(90);
            Mogre.Degree l_ShoePitchAngle = new Mogre.Degree(-20);

            Mogre.Degree l_DegreeRollAngle = new Mogre.Degree(30);

            foreach (WiimoteOrgeControlShape l_Shape in mDynamicShapes)
            {
                l_ShapeIndex++;

                if (l_Shape.Foot.CompareTo(ProjectCommon.ProjectConstants.SHAPE_LEFT_FOOT) == 0)
                    l_SceneNode = mWiimote1SceneNode.CreateChildSceneNode("Wiimote1Node" + l_ShapeIndex, new Vector3(0,//l_Wiimote1XPosition,
                                                                                                                    l_StartingYPosition * l_Shape.Time,
                                                                                                                    l_StartingZPosition * l_Shape.Time));
                else
                    l_SceneNode = mWiimote2SceneNode.CreateChildSceneNode("Wiimote2Node" + l_ShapeIndex, new Vector3(0,//l_Wiimote2XPosition,
                                                                                                                    l_StartingYPosition * l_Shape.Time,
                                                                                                                    l_StartingZPosition * l_Shape.Time));
                l_SceneNode.Scale(2f, 2f, 2f);
                l_SceneNode.Yaw(l_ShoeYawAngle);
            //                l_SceneNode.Pitch(l_ShoePitchAngle);
            //                l_SceneNode.Roll(30);

                InitialShoeRollAngle = l_SceneNode.Orientation.Roll.ValueDegrees;
                InitialShoePitchAngle = l_SceneNode.Orientation.Pitch.ValueDegrees;

                mInitialShoeAxis = l_SceneNode.Orientation;
                mInitialShoeAxis.w = InitialShoeRollAngle;

                drawShoe(l_SceneNode, "Shoe" + l_ShapeIndex);

                //TODO : Need to get back movable text
                // create entity
            //                MovableText msg = new MovableText("txt001", l_Shape.Message, "BlueHighway", 6, new ColourValue(200, 50, 200));
            //                msg.SetTextAlignment(MovableText.HorizontalAlignment.H_CENTER, MovableText.VerticalAlignment.V_ABOVE);
            //                msg.AdditionalHeight = 8.0f;

                // attach to a SceneNode
            //                l_SceneNode.AttachObject(msg);

            }

            /*
            //            SceneNode l_TestShoeNode = mNode.CreateChildSceneNode("TestShoeNode",new Vector3(0f, 0f, 0f));
                        SceneNode l_TestShoeNode = SceneManager.RootSceneNode.CreateChildSceneNode("TestShoeNode",new Vector3(0f, 0f, 0f));

                        drawShoe(l_TestShoeNode,"TestShoe");
                        l_TestShoeNode.Scale(5f, 5f, 5f);
                        Mogre.Degree l_ShoeYawAngle = new Mogre.Degree(90);
                        l_TestShoeNode.Yaw(l_ShoeYawAngle.ValueRadians);
                        Mogre.Degree l_ShoePitchAngle = new Mogre.Degree(-20);
                        l_TestShoeNode.Pitch(l_ShoePitchAngle.ValueRadians);
                        */

            mNode.Translate(new Vector3(mWidth / 8, 0f, 0f));

            Mogre.Degree l_DegreeAngle = new Mogre.Degree(-15);
            //            l_WimmoteTapMotionNode.Yaw(l_DegreeAngle.ValueRadians);
            mQuatDirection = new Quaternion(l_DegreeAngle.ValueRadians, Vector3.UNIT_Z);

            mNode.Rotate(mQuatDirection);

            mDirection = new Vector3(0f, l_EndingYPosition / 8, l_EndingZPosition / 8).NormalisedCopy;

            mTapNodePosition = mDirection;
        }
开发者ID:sachindeshpande,项目名称:TRapperProject,代码行数:101,代码来源:MogreWrapperMain.cs

示例3: CreateScene

        // Scene creation
        public override void CreateScene()
        {
            // Set ambient light
            sceneMgr.AmbientLight = new ColourValue(0.2F, 0.2F, 0.2F);

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

            // 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(20F, 80F, 50F);

            // Define a floor plane mesh
            Plane p;
            p.normal = Vector3.UNIT_Y;
            p.d = 200;
            MeshManager.Singleton.CreatePlane("FloorPlane", ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME, p, 200000F, 20000F, 20, 20, true, 1, 50F, 50F, Vector3.UNIT_Z);

            Entity ent;
            // Create an entity (the floor)
            ent = sceneMgr.CreateEntity("floor", "FloorPlane");
            ent.SetMaterialName("Examples/RustySteel");

            // Attach to child of root node, better for culling (otherwise bounds are the combination of the 2)
            sceneMgr.RootSceneNode.CreateChildSceneNode().AttachObject(ent);

            // Add a head, give it it's own node
            headNode = sceneMgr.RootSceneNode.CreateChildSceneNode();
            ent = sceneMgr.CreateEntity("head", "cylinder.mesh");
            //ent.SetMaterialName("materials/texturesRustySteel");

            //       y
            //       ^
            //       |
            // x <---x z

            headNode.AttachObject(ent);
            headNode.Scale(2,10,10);
            //headNode.Rotate(new Vector3(0,0,1), new Radian(Math.PI / 2F));
            headNode.Rotate(new Vector3(0, 0, 1F), Math.HALF_PI);

            // Make sure the camera track this node
            //camera.SetAutoTracking(true, headNode);

            // Create the camera node & attach camera
            SceneNode camNode = sceneMgr.RootSceneNode.CreateChildSceneNode();
            camNode.AttachObject(camera);

            // set up spline animation of node
            //Animation anim = sceneMgr.CreateAnimation("CameraTrack", 10F);

            // Spline it for nice curves

            //anim.SetInterpolationMode(Animation.InterpolationMode.IM_SPLINE);
            //// Create a track to animate the camera's node
            //NodeAnimationTrack track = anim.CreateNodeTrack(0, camNode);

            //// Setup keyframes
            //TransformKeyFrame key = track.CreateNodeKeyFrame(0F); // startposition
            //key = track.CreateNodeKeyFrame(2.5F);
            //key.Translate = new Vector3(500F, 500F, -1000F);
            //key = track.CreateNodeKeyFrame(5F);
            //key.Translate = new Vector3(-1500F, 1000F, -600F);
            //key = track.CreateNodeKeyFrame(7.5F);
            //key.Translate = new Vector3(0F, 100F, 0F);
            //key = track.CreateNodeKeyFrame(10F);
            //key.Translate = new Vector3(0F, 0F, 0F);

            //// Create a new animation state to track this
            //animState = sceneMgr.CreateAnimationState("CameraTrack");
            //animState.Enabled = true;

            // Put in a bit of fog for the hell of it
            //sceneMgr.SetFog(FogMode.FOG_EXP, ColourValue.White, 0.0002F);
        }
开发者ID:joproulx,项目名称:FrisbeeSimulator,代码行数:80,代码来源:Program.cs

示例4: ChangeVisible

        /// <summary>
        /// Changes the bullet visibility. Visible is true -> Creates SceneNode and checks Entity (if is null -> initializes).
        /// Visible is false -> Destroys SceneNode and save actual position.
        /// </summary>
        public virtual void ChangeVisible(bool visible)
        {
            if (visible && sceneNode == null) {
                // Controls if the entity is inicialized
                if (entity == null) {
                    entity = Game.SceneManager.CreateEntity(name, mesh);
                }

                sceneNode = Game.SceneManager.RootSceneNode.CreateChildSceneNode(name + "Node", position);
                sceneNode.AttachObject(entity);

                Vector3 src = sceneNode.Orientation * Vector3.NEGATIVE_UNIT_Z;

                // SceneNode rotation
                if ((1.0f + src.DotProduct(direction)) < 0.0001f) {
                    sceneNode.Yaw(new Angle(180.0f));
                } else {
                    Quaternion quat = src.GetRotationTo(direction);
                    sceneNode.Rotate(quat);
                }
            } else {
                if (sceneNode != null) {
                    position = sceneNode.Position;
                    Game.SceneManager.DestroySceneNode(sceneNode);
                    sceneNode = null;
                }

            }
        }
开发者ID:vavrekmichal,项目名称:Strategy,代码行数:33,代码来源:Missile2.cs

示例5: setWindow

 public override void setWindow(OgreWindow win)
 {
     this.win = win;
     //// Create a slot machine barrel
     entity_myentity = win.mSceneMgr.CreateEntity("cylinder123", "cylinder.mesh");
     entity_myentity.CastShadows = true;
     sn_barrel1 = win.mSceneMgr.RootSceneNode.CreateChildSceneNode();
     sn_barrel1.AttachObject(entity_myentity);
     sn_barrel1.Position -= new Mogre.Vector3(8f, 6f, 14f);
     sn_barrel1.Rotate(new Mogre.Vector3(0.0f, 0.0f, 1.0f), new Radian(1.55f));
     //// Create a slot machine barrel
     entity_myentity2 = win.mSceneMgr.CreateEntity("cylinder2", "cylinder.mesh");
     entity_myentity2.CastShadows = true;
     sn_barrel2 = win.mSceneMgr.RootSceneNode.CreateChildSceneNode();
     sn_barrel2.AttachObject(entity_myentity2);
     sn_barrel2.Position -= new Mogre.Vector3(7.42f, 6f, 14f);
     sn_barrel2.Rotate(new Mogre.Vector3(0.0f, 0.0f, 1.0f), new Radian(1.55f));
     //// Create a slot machine barrel
     entity_myentity3 = win.mSceneMgr.CreateEntity("cylinder3", "cylinder.mesh");
     entity_myentity3.CastShadows = true;
     sn_barrel3 = win.mSceneMgr.RootSceneNode.CreateChildSceneNode();
     sn_barrel3.AttachObject(entity_myentity3);
     sn_barrel3.Position -= new Mogre.Vector3(6.84f, 6f, 14f);
     sn_barrel3.Rotate(new Mogre.Vector3(0.0f, 0.0f, 1.0f), new Radian(1.55f));
     //// Create a slot machine barrel
     entity_myentity4 = win.mSceneMgr.CreateEntity("cylinder4", "cylinder.mesh");
     entity_myentity4.CastShadows = true;
     sn_barrel4 = win.mSceneMgr.RootSceneNode.CreateChildSceneNode();
     sn_barrel4.AttachObject(entity_myentity4);
     sn_barrel4.Position -= new Mogre.Vector3(6.26f, 6f, 14f);
     sn_barrel4.Rotate(new Mogre.Vector3(0.0f, 0.0f, 1.0f), new Radian(1.55f));
     ent1 = win.mSceneMgr.CreateEntity("border", "border.mesh");
     ent1.CastShadows = true;
     sn1 = win.mSceneMgr.RootSceneNode.CreateChildSceneNode();
     sn1.AttachObject(ent1);
     sn1.Position -= new Mogre.Vector3(8.14f, 6f, 14f);
     //ent1 = win.mSceneMgr.CreateEntity("zeliard", "zeliard.mesh");
     //ent1.CastShadows = true;
     //sn1 = win.mSceneMgr.RootSceneNode.CreateChildSceneNode();
     //sn1.AttachObject(ent1);
     //sn1.Position -= new Mogre.Vector3(3f, 6f, 14f);
 }
开发者ID:andyhebear,项目名称:extramegablob,代码行数:42,代码来源:SlotMachine.cs


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