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


C# ScenePresence.GetWorldRotation方法代码示例

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


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

示例1: GetAgentParams

        /// <summary>
        /// Gets params for a seated avatar in a linkset.
        /// </summary>
        /// <returns></returns>
        /// <param name='sp'></param>
        /// <param name='rules'></param>
        /// <param name='res'></param>
        public LSL_List GetAgentParams(ScenePresence sp, LSL_List rules, ref LSL_List res)
        {
            int idx = 0;
            while (idx < rules.Length)
            {
                int code = (int)rules.GetLSLIntegerItem(idx++);
                int remain = rules.Length-idx;

                switch (code)
                {
                    case (int)ScriptBaseClass.PRIM_MATERIAL:
                        res.Add(new LSL_Integer(ScriptBaseClass.PRIM_MATERIAL_FLESH));
                        break;

                    case (int)ScriptBaseClass.PRIM_PHYSICS:
                        res.Add(ScriptBaseClass.FALSE);
                        break;

                    case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ:
                        res.Add(ScriptBaseClass.FALSE);
                        break;

                    case (int)ScriptBaseClass.PRIM_PHANTOM:
                        res.Add(ScriptBaseClass.FALSE);
                        break;

                    case (int)ScriptBaseClass.PRIM_POSITION:
                        res.Add(new LSL_Vector(sp.AbsolutePosition));
                        break;

                    case (int)ScriptBaseClass.PRIM_SIZE:
                        res.Add(GetAgentSize(sp));
                        break;

                    case (int)ScriptBaseClass.PRIM_ROTATION:
                        res.Add(sp.GetWorldRotation());
                        break;

                    case (int)ScriptBaseClass.PRIM_TYPE:
                        res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TYPE_BOX));
                        res.Add(new LSL_Integer(ScriptBaseClass.PRIM_HOLE_DEFAULT));
                        res.Add(new LSL_Vector(0, 1, 0));
                        res.Add(new LSL_Float(0));
                        res.Add(new LSL_Vector(0, 0, 0));
                        res.Add(new LSL_Vector(1, 1, 0));
                        res.Add(new LSL_Vector(0, 0, 0));
                        break;

                    case (int)ScriptBaseClass.PRIM_TEXTURE:
                        if (remain < 1)
                            return null;

                        int face = (int)rules.GetLSLIntegerItem(idx++);
                        if (face > 21)
                            break;

                        res.Add(new LSL_String(""));
                        res.Add(ScriptBaseClass.ZERO_VECTOR);
                        res.Add(ScriptBaseClass.ZERO_VECTOR);
                        res.Add(new LSL_Float(0));
                        break;

                    case (int)ScriptBaseClass.PRIM_COLOR:
                        if (remain < 1)
                            return null;

                        face = (int)rules.GetLSLIntegerItem(idx++);
                        if (face > 21)
                            break;

                        res.Add(ScriptBaseClass.ZERO_VECTOR);
                        res.Add(new LSL_Float(0));
                        break;

                    case (int)ScriptBaseClass.PRIM_BUMP_SHINY:
                        if (remain < 1)
                            return null;

                        face = (int)rules.GetLSLIntegerItem(idx++);
                        if (face > 21)
                            break;

                        res.Add(ScriptBaseClass.PRIM_SHINY_NONE);
                        res.Add(ScriptBaseClass.PRIM_BUMP_NONE);
                        break;

                    case (int)ScriptBaseClass.PRIM_FULLBRIGHT:
                        if (remain < 1)
                            return null;

                        face = (int)rules.GetLSLIntegerItem(idx++);
                        if (face > 21)
                            break;
//.........这里部分代码省略.........
开发者ID:Barosonix,项目名称:Barosonix-Core,代码行数:101,代码来源:LSL_Api.cs

示例2: GetPrimParams

        public LSL_List GetPrimParams(ScenePresence avatar, LSL_List rules, ref LSL_List res)
        {
            // avatars case
            // replies as SL wiki

//            SceneObjectPart sitPart = avatar.ParentPart; // most likelly it will be needed
            SceneObjectPart sitPart = World.GetSceneObjectPart(avatar.ParentID); // maybe better do this expensive search for it in case it's gone??

            int idx = 0;
            while (idx < rules.Length)
            {
                int code = (int)rules.GetLSLIntegerItem(idx++);
                int remain = rules.Length - idx;

                switch (code)
                {
                    case (int)ScriptBaseClass.PRIM_MATERIAL:
                        res.Add(new LSL_Integer((int)SOPMaterialData.SopMaterial.Flesh));
                        break;

                    case (int)ScriptBaseClass.PRIM_PHYSICS:
                            res.Add(new LSL_Integer(0));
                        break;

                    case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ:
                            res.Add(new LSL_Integer(0));
                        break;

                    case (int)ScriptBaseClass.PRIM_PHANTOM:
                            res.Add(new LSL_Integer(0));
                        break;

                    case (int)ScriptBaseClass.PRIM_POSITION:
                        Vector3 pos;

                        if (sitPart.ParentGroup.RootPart != null)
                        {
                            pos = avatar.OffsetPosition;

                            if(!avatar.LegacySitOffsets)
                            {
                                Vector3 sitOffset = (Zrot(avatar.Rotation)) * (avatar.Appearance.AvatarHeight * 0.02638f *2.0f);
                                pos -= sitOffset;
                            }

                            SceneObjectPart sitroot = sitPart.ParentGroup.RootPart;
                            pos = sitroot.AbsolutePosition + pos * sitroot.GetWorldRotation();
                        }
                        else
                            pos = avatar.AbsolutePosition;     

                        res.Add(new LSL_Vector(pos.X,pos.Y,pos.Z));
                        break;

                    case (int)ScriptBaseClass.PRIM_SIZE:
                        Vector3 s = avatar.Appearance.AvatarSize;
                        res.Add(new LSL_Vector(s.X, s.Y, s.Z));

                        break;

                    case (int)ScriptBaseClass.PRIM_ROTATION:
                        res.Add(new LSL_Rotation(avatar.GetWorldRotation()));
                        break;

                    case (int)ScriptBaseClass.PRIM_TYPE:
                        res.Add(new LSL_Integer(ScriptBaseClass.PRIM_TYPE_BOX));
                        res.Add(new LSL_Integer(ScriptBaseClass.PRIM_HOLE_DEFAULT));
                        res.Add(new LSL_Vector(0f,1.0f,0f));
                        res.Add(new LSL_Float(0.0f));
                        res.Add(new LSL_Vector(0, 0, 0));
                        res.Add(new LSL_Vector(1.0f,1.0f,0f));
                        res.Add(new LSL_Vector(0, 0, 0));
                        break;

                    case (int)ScriptBaseClass.PRIM_TEXTURE:
                        if (remain < 1)
                            return new LSL_List();

                        int face = (int)rules.GetLSLIntegerItem(idx++);
                        if (face == ScriptBaseClass.ALL_SIDES)
                        {
                            for (face = 0; face < 21; face++)
                            {
                                res.Add(new LSL_String(""));
                                res.Add(new LSL_Vector(0,0,0));
                                res.Add(new LSL_Vector(0,0,0));
                                res.Add(new LSL_Float(0.0));
                            }
                        }
                        else
                        {
                            if (face >= 0 && face < 21)
                            {
                                res.Add(new LSL_String(""));
                                res.Add(new LSL_Vector(0,0,0));
                                res.Add(new LSL_Vector(0,0,0));
                                res.Add(new LSL_Float(0.0));
                            }
                        }
                        break;
//.........这里部分代码省略.........
开发者ID:TomDataworks,项目名称:opensim,代码行数:101,代码来源:LSL_Api.cs


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