• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# LSL_Types.Vector3类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中WhiteCore.ScriptEngine.DotNetEngine.LSL_Types.Vector3的典型用法代码示例。如果您正苦于以下问题:C# WhiteCore.ScriptEngine.DotNetEngine.LSL_Types.Vector3类的具体用法?C# WhiteCore.ScriptEngine.DotNetEngine.LSL_Types.Vector3怎么用?C# WhiteCore.ScriptEngine.DotNetEngine.LSL_Types.Vector3使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



WhiteCore.ScriptEngine.DotNetEngine.LSL_Types.Vector3类属于命名空间,在下文中一共展示了WhiteCore.ScriptEngine.DotNetEngine.LSL_Types.Vector3类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: botCreateBot

 public LSL_String botCreateBot(string firstName, string lastName, string appearanceToClone, LSL_Vector startPos)
 {
     if (!ScriptProtection.CheckThreatLevel(ThreatLevel.Moderate, "botCreateBot", m_host, "bot", m_itemID))
         return "";
     IBotManager manager = World.RequestModuleInterface<IBotManager>();
     if (manager != null)
         return
             new LSL_String(
                 manager.CreateAvatar(firstName, lastName, m_host.ParentEntity.Scene,
                                      UUID.Parse(appearanceToClone), m_host.OwnerID,
                                      new Vector3((float) startPos.x, (float) startPos.y, (float) startPos.z)).
                         ToString());
     return new LSL_String("");
 }
开发者ID:EnricoNirvana,项目名称:WhiteCore-Dev,代码行数:14,代码来源:Bot_API.cs


示例2: llScriptDanger

        public LSL_Integer llScriptDanger(LSL_Vector pos)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) 
                return 0;

            bool result = m_ScriptEngine.PipeEventsForScript(m_host,
                                                             new Vector3((float)pos.x, (float)pos.y, (float)pos.z));
            if (result)
            {
                return 1;
            }
            return 0;
        }
开发者ID:WhiteCoreSim,项目名称:WhiteCore-Dev,代码行数:13,代码来源:LSL_Api.cs


示例3: llGroundSlope

        public LSL_Vector llGroundSlope(LSL_Vector offset)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
                return new LSL_Vector();

            //Get the slope normal.  This gives us the equation of the plane tangent to the slope.
            LSL_Vector vsn = llGroundNormal(offset);

            //Plug the x,y coordinates of the slope normal into the equation of the plane to get
            //the height of that point on the plane.  The resulting vector gives the slope.
            Vector3 vsl = new Vector3
                              {
                                  X = (float)vsn.x,
                                  Y = (float)vsn.y,
                                  Z = (float)(((vsn.x * vsn.x) + (vsn.y * vsn.y)) / (-1 * vsn.z))
                              };
            vsl.Normalize();
            //Normalization might be overkill here

            return new LSL_Vector(vsl.X, vsl.Y, vsl.Z);
        }
开发者ID:WhiteCoreSim,项目名称:WhiteCore-Dev,代码行数:21,代码来源:LSL_Api.cs


示例4: llGroundNormal

        public LSL_Vector llGroundNormal(LSL_Vector offset)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
                return new LSL_Vector();

            Vector3 pos = m_host.GetWorldPosition() + new Vector3((float)offset.x,
                                                                  (float)offset.y,
                                                                  (float)offset.z);
            ITerrainChannel heightmap = World.RequestModuleInterface<ITerrainChannel>();
            // Clamp to valid position
            if (pos.X < 0)
                pos.X = 0;
            else if (pos.X >= heightmap.Width)
                pos.X = heightmap.Width - 1;
            if (pos.Y < 0)
                pos.Y = 0;
            else if (pos.Y >= heightmap.Height)
                pos.Y = heightmap.Height - 1;

            //Find two points in addition to the position to define a plane
            Vector3 p0 = new Vector3(pos.X, pos.Y,
                                     heightmap[(int)pos.X, (int)pos.Y]);
            Vector3 p1 = new Vector3();
            Vector3 p2 = new Vector3();
            if ((pos.X + 1.0f) >= heightmap.Width)
                p1 = new Vector3(pos.X + 1.0f, pos.Y,
                                 heightmap[(int)pos.X, (int)pos.Y]);
            else
                p1 = new Vector3(pos.X + 1.0f, pos.Y,
                                 heightmap[(int)(pos.X + 1.0f), (int)pos.Y]);
            if ((pos.Y + 1.0f) >= heightmap.Height)
                p2 = new Vector3(pos.X, pos.Y + 1.0f,
                                 heightmap[(int)pos.X, (int)pos.Y]);
            else
                p2 = new Vector3(pos.X, pos.Y + 1.0f,
                                 heightmap[(int)pos.X, (int)(pos.Y + 1.0f)]);

            //Find normalized vectors from p0 to p1 and p0 to p2
            Vector3 v0 = new Vector3(p1.X - p0.X, p1.Y - p0.Y, p1.Z - p0.Z);
            Vector3 v1 = new Vector3(p2.X - p0.X, p2.Y - p0.Y, p2.Z - p0.Z);
            //            v0.Normalize();
            //            v1.Normalize();

            //Find the cross product of the vectors (the slope normal).
            Vector3 vsn = new Vector3
                              {
                                  X = (v0.Y * v1.Z) - (v0.Z * v1.Y),
                                  Y = (v0.Z * v1.X) - (v0.X * v1.Z),
                                  Z = (v0.X * v1.Y) - (v0.Y * v1.X)
                              };
            vsn.Normalize();
            //I believe the crossproduct of two normalized vectors is a normalized vector so
            //this normalization may be overkill
            // then don't normalize them just the result

            return new LSL_Vector(vsn.X, vsn.Y, vsn.Z);
        }
开发者ID:WhiteCoreSim,项目名称:WhiteCore-Dev,代码行数:57,代码来源:LSL_Api.cs


示例5: llSetLinkCamera

        public void llSetLinkCamera(LSL_Integer link, LSL_Vector eye, LSL_Vector at)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) 
                return;

            List<ISceneChildEntity> entities = GetLinkParts(link);
            if (entities.Count > 0)
            {
                entities[0].CameraEyeOffset = new Vector3((float)eye.x, (float)eye.y, (float)eye.z);
                entities[0].CameraAtOffset = new Vector3((float)at.x, (float)at.y, (float)at.z);
            }
        }
开发者ID:WhiteCoreSim,项目名称:WhiteCore-Dev,代码行数:12,代码来源:LSL_Api.cs


示例6: llSetCameraAtOffset

        public void llSetCameraAtOffset(LSL_Vector offset)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) 
                return;

            m_host.CameraAtOffset = new Vector3((float)offset.x, (float)offset.y, (float)offset.z);
        }
开发者ID:WhiteCoreSim,项目名称:WhiteCore-Dev,代码行数:7,代码来源:LSL_Api.cs


示例7: SetParticleSystem

        private void SetParticleSystem(ISceneChildEntity part, LSL_List rules)
        {
            if (rules.Length == 0)
            {
                part.RemoveParticleSystem();
            }
            else
            {
                Primitive.ParticleSystem prules = getNewParticleSystemWithSLDefaultValues();
                LSL_Vector tempv = new LSL_Vector();
                float tempf = 0;
                int tmpi = 0;

                for (int i = 0; i < rules.Length; i += 2)
                {
                        LSL_Integer rule = rules.GetLSLIntegerItem(i);
                        if (rule == (int)ScriptBaseClass.PSYS_PART_FLAGS)
                        {
                            prules.PartDataFlags =
                                (Primitive.ParticleSystem.ParticleDataFlags)(uint)rules.GetLSLIntegerItem(i + 1);
                        }

                        else if (rule == (int)ScriptBaseClass.PSYS_PART_START_COLOR)
                        {
                            tempv = rules.GetVector3Item(i + 1);
                            prules.PartStartColor.R = (float)tempv.x;
                            prules.PartStartColor.G = (float)tempv.y;
                            prules.PartStartColor.B = (float)tempv.z;
                        }

                        else if (rule == (int)ScriptBaseClass.PSYS_PART_START_ALPHA)
                        {
                            tempf = (float)rules.GetLSLFloatItem(i + 1);
                            prules.PartStartColor.A = tempf;
                        }

                        else if (rule == (int)ScriptBaseClass.PSYS_PART_END_COLOR)
                        {
                            tempv = rules.GetVector3Item(i + 1);
                            prules.PartEndColor.R = (float)tempv.x;
                            prules.PartEndColor.G = (float)tempv.y;
                            prules.PartEndColor.B = (float)tempv.z;
                        }

                        else if (rule == (int)ScriptBaseClass.PSYS_PART_END_ALPHA)
                        {
                            tempf = (float)rules.GetLSLFloatItem(i + 1);
                            prules.PartEndColor.A = tempf;
                        }

                        else if (rule == (int)ScriptBaseClass.PSYS_PART_START_SCALE)
                        {
                            tempv = rules.GetVector3Item(i + 1);
                            prules.PartStartScaleX = (float)tempv.x;
                            prules.PartStartScaleY = (float)tempv.y;
                        }

                        else if (rule == (int)ScriptBaseClass.PSYS_PART_END_SCALE)
                        {
                            tempv = rules.GetVector3Item(i + 1);
                            prules.PartEndScaleX = (float)tempv.x;
                            prules.PartEndScaleY = (float)tempv.y;
                        }

                        else if (rule == (int)ScriptBaseClass.PSYS_PART_MAX_AGE)
                        {
                            tempf = (float)rules.GetLSLFloatItem(i + 1);
                            prules.PartMaxAge = tempf;
                        }

                        else if (rule == (int)ScriptBaseClass.PSYS_SRC_ACCEL)
                        {
                            tempv = rules.GetVector3Item(i + 1);
                            prules.PartAcceleration.X = (float)tempv.x;
                            prules.PartAcceleration.Y = (float)tempv.y;
                            prules.PartAcceleration.Z = (float)tempv.z;
                        }

                        else if (rule == (int)ScriptBaseClass.PSYS_SRC_PATTERN)
                        {
                            tmpi = rules.GetLSLIntegerItem(i + 1);
                            prules.Pattern = (Primitive.ParticleSystem.SourcePattern)tmpi;
                        }

                            // PSYS_SRC_INNERANGLE and PSYS_SRC_ANGLE_BEGIN use the same variables. The
                        // PSYS_SRC_OUTERANGLE and PSYS_SRC_ANGLE_END also use the same variable. The
                        // client tells the difference between the two by looking at the 0x02 bit in
                        // the PartFlags variable.
                        else if (rule == (int)ScriptBaseClass.PSYS_SRC_INNERANGLE)
                        {
                            tempf = (float)rules.GetLSLFloatItem(i + 1);
                            prules.InnerAngle = tempf;
                            prules.PartFlags &= 0xFFFFFFFD; // Make sure new angle format is off.
                        }

                        else if (rule == (int)ScriptBaseClass.PSYS_SRC_OUTERANGLE)
                        {
                            tempf = (float)rules.GetLSLFloatItem(i + 1);
                            prules.OuterAngle = tempf;
                            prules.PartFlags &= 0xFFFFFFFD; // Make sure new angle format is off.
//.........这里部分代码省略.........
开发者ID:WhiteCoreSim,项目名称:WhiteCore-Dev,代码行数:101,代码来源:LSL_Api.cs


示例8: llSetVehicleVectorParam

        public void llSetVehicleVectorParam(int param, LSL_Vector vec)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) 
                return;

            if (m_host.ParentEntity != null)
            {
                if (!m_host.ParentEntity.IsDeleted)
                {
                    m_host.ParentEntity.RootChild.SetVehicleVectorParam(param,
                                                                        new Vector3((float)vec.x, (float)vec.y,
                                                                                    (float)vec.z));
                }
            }
        }
开发者ID:WhiteCoreSim,项目名称:WhiteCore-Dev,代码行数:15,代码来源:LSL_Api.cs


示例9: SitTarget

        protected void SitTarget (ISceneChildEntity part, LSL_Vector offset, LSL_Rotation rot)
        {
            // LSL quaternions can normalize to 0, normal Quaternions can't.
            if (FloatAlmostEqual (rot.s, 0) &&
                FloatAlmostEqual (rot.x, 0) &&
                FloatAlmostEqual (rot.y, 0) &&
                FloatAlmostEqual (rot.z, 0))
                rot.z = 1; // ZERO_ROTATION = 0,0,0,1

            part.SitTargetPosition = new Vector3 ((float)offset.x, (float)offset.y, (float)offset.z);;
            part.SitTargetOrientation = Rot2Quaternion (rot);;
            part.ParentEntity.HasGroupChanged = true;
        }
开发者ID:WhiteCoreSim,项目名称:WhiteCore-Dev,代码行数:13,代码来源:LSL_Api.cs


示例10: llGetBoundingBox

        /// <summary>
        ///     A partial implementation.
        ///     http://lslwiki.net/lslwiki/wakka.php?wakka=llGetBoundingBox
        ///     So far only valid for standing/flying/ground sitting avatars and single prim objects.
        ///     If the object has multiple prims and/or a sitting avatar then the bounding
        ///     box is for the root prim only.
        /// </summary>
        public LSL_List llGetBoundingBox(string obj)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
                return new LSL_List();

            UUID objID = UUID.Zero;
            LSL_List result = new LSL_List();
            if (!UUID.TryParse(obj, out objID))
            {
                result.Add(new LSL_Vector());
                result.Add(new LSL_Vector());
                return result;
            }
            IScenePresence presence = World.GetScenePresence(objID);
            if (presence != null)
            {
                if (presence.ParentID == UUID.Zero) // not sat on an object
                {
                    LSL_Vector lower = new LSL_Vector();
                    LSL_Vector upper = new LSL_Vector();
                    if (presence.Animator.Animations.ImplicitDefaultAnimation.AnimID
                        == AnimationSet.Animations.AnimsUUID["SIT_GROUND_CONSTRAINED"])
                    {
                        // This is for ground sitting avatars
                        IAvatarAppearanceModule appearance = presence.RequestModuleInterface<IAvatarAppearanceModule>();
                        if (appearance != null)
                        {
                            float height = appearance.Appearance.AvatarHeight / 2.66666667f;
                            lower = new LSL_Vector(-0.3375f, -0.45f, height * -1.0f);
                            upper = new LSL_Vector(0.3375f, 0.45f, 0.0f);
                        }
                    }
                    else
                    {
                        // This is for standing/flying avatars
                        IAvatarAppearanceModule appearance = presence.RequestModuleInterface<IAvatarAppearanceModule>();
                        if (appearance != null)
                        {
                            float height = appearance.Appearance.AvatarHeight / 2.0f;
                            lower = new LSL_Vector(-0.225f, -0.3f, height * -1.0f);
                            upper = new LSL_Vector(0.225f, 0.3f, height + 0.05f);
                        }
                    }
                    result.Add(lower);
                    result.Add(upper);
                    return result;
                }
                // sitting on an object so we need the bounding box of that
                // which should include the avatar so set the UUID to the
                // UUID of the object the avatar is sat on and allow it to fall through
                // to processing an object
                ISceneChildEntity p = World.GetSceneObjectPart(presence.ParentID);
                objID = p.UUID;
            }
            ISceneChildEntity part = World.GetSceneObjectPart(objID);
            // Currently only works for single prims without a sitting avatar
            if (part != null)
            {
                Vector3 halfSize = part.Scale * 0.5f;
                LSL_Vector lower = new LSL_Vector(halfSize.X * -1.0f, halfSize.Y * -1.0f, halfSize.Z * -1.0f);
                LSL_Vector upper = new LSL_Vector(halfSize.X, halfSize.Y, halfSize.Z);
                result.Add(lower);
                result.Add(upper);
                return result;
            }

            // Not found so return empty values
            result.Add(new LSL_Vector());
            result.Add(new LSL_Vector());
            return result;
        }
开发者ID:WhiteCoreSim,项目名称:WhiteCore-Dev,代码行数:78,代码来源:LSL_Api.cs


示例11: GetLinkPrimitiveParams

        public LSL_List GetLinkPrimitiveParams(ISceneChildEntity part, LSL_List rules, bool allowOpenSimParams)
        {
            LSL_List res = new LSL_List();
            int idx = 0;
            while (idx < rules.Length)
            {
                int code = rules.GetLSLIntegerItem(idx++);
                int remain = rules.Length - idx;
                Primitive.TextureEntry tex = part.Shape.Textures;
                int face = 0;

                if (code == (int)ScriptBaseClass.PRIM_NAME)
                {
                    res.Add(new LSL_String(part.Name));
                }

                else if (code == (int)ScriptBaseClass.PRIM_DESC)
                {
                    res.Add(new LSL_String(part.Description));
                }

                else if (code == (int)ScriptBaseClass.PRIM_MATERIAL)
                {
                    res.Add(new LSL_Integer(part.Material));
                }

                else if (code == (int)ScriptBaseClass.PRIM_PHYSICS)
                {
                    res.Add((part.GetEffectiveObjectFlags() & (uint)PrimFlags.Physics) != 0
                                ? new LSL_Integer(1)
                                : new LSL_Integer(0));
                }

                else if (code == (int)ScriptBaseClass.PRIM_TEMP_ON_REZ)
                {
                    res.Add((part.GetEffectiveObjectFlags() & (uint)PrimFlags.TemporaryOnRez) != 0
                                ? new LSL_Integer(1)
                                : new LSL_Integer(0));
                }

                else if (code == (int)ScriptBaseClass.PRIM_PHANTOM)
                {
                    res.Add((part.GetEffectiveObjectFlags() & (uint)PrimFlags.Phantom) != 0
                                ? new LSL_Integer(1)
                                : new LSL_Integer(0));
                }

                else if (code == (int)ScriptBaseClass.PRIM_POSITION)
                {
                    Vector3 tmp = part.AbsolutePosition;
                    LSL_Vector v = new LSL_Vector(tmp.X,
                                                  tmp.Y,
                                                  tmp.Z);
                    // For some reason, the part.AbsolutePosition.* values do not change if the
                    // linkset is rotated; they always reflect the child prim's world position
                    // as though the linkset is unrotated. This is incompatible behavior with SL's
                    // implementation, so will break scripts imported from there (not to mention it
                    // makes it more difficult to determine a child prim's actual inworld position).
                    if (part.ParentID != 0)
                    {
                        LSL_Rotation rtmp = llGetRootRotation();
                        LSL_Vector rpos = llGetRootPosition();
                        v = ((v - rpos) * rtmp) + rpos;
                    }
                    res.Add(v);
                }
                else if (code == (int)ScriptBaseClass.PRIM_POS_LOCAL)
                {
                    res.Add(GetLocalPos(part));
                }
                else if (code == (int)ScriptBaseClass.PRIM_SIZE)
                {
                    Vector3 tmp = part.Scale;
                    res.Add(new LSL_Vector(tmp.X,
                                           tmp.Y,
                                           tmp.Z));
                }

                else if (code == (int)ScriptBaseClass.PRIM_ROTATION)
                {
                    res.Add(GetPartRot(part));
                }

                else if (code == (int)ScriptBaseClass.PRIM_TYPE)
                {
                    // implementing box
                    PrimitiveBaseShape Shape = part.Shape;
                    int primType = (int)part.GetPrimType();
                    res.Add(new LSL_Integer(primType));
                    double topshearx = (sbyte)Shape.PathShearX / 100.0; // Fix negative values for PathShearX
                    double topsheary = (sbyte)Shape.PathShearY / 100.0; // and PathShearY.
                    if (primType == ScriptBaseClass.PRIM_TYPE_BOX ||
                        primType == ScriptBaseClass.PRIM_TYPE_CYLINDER ||
                        primType == ScriptBaseClass.PRIM_TYPE_PRISM)
                    {
                        res.Add(new LSL_Integer(Shape.ProfileCurve));
                        res.Add(new LSL_Vector(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0));
                        res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0));
                        res.Add(new LSL_Vector(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0));
                        res.Add(new LSL_Vector(1 - (Shape.PathScaleX / 100.0 - 1), 1 - (Shape.PathScaleY / 100.0 - 1), 0));
//.........这里部分代码省略.........
开发者ID:WhiteCoreSim,项目名称:WhiteCore-Dev,代码行数:101,代码来源:LSL_Api.cs


示例12: botSitObject

        public void botSitObject(string bot, string objectID, LSL_Vector offset)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.Moderate, "botTouchObject", m_host, "bot", m_itemID))
                return;
            IScenePresence sp = World.GetScenePresence(UUID.Parse(bot));
            if (sp == null)
                return;
            ISceneChildEntity child = World.GetSceneObjectPart(UUID.Parse(objectID));
            if (child == null)
                throw new Exception("Failed to find entity to sit on");

            sp.HandleAgentRequestSit(sp.ControllingClient, UUID.Parse(objectID),
                                     new Vector3((float) offset.x, (float) offset.y, (float) offset.z));
        }
开发者ID:QueenStarfinder,项目名称:WhiteCore-Dev,代码行数:14,代码来源:Bot_API.cs


示例13: GetTextureOffset

 protected LSL_Vector GetTextureOffset(ISceneChildEntity part, int face)
 {
     Primitive.TextureEntry tex = part.Shape.Textures;
     LSL_Vector offset = new LSL_Vector();
     if (face == ScriptBaseClass.ALL_SIDES)
     {
         face = 0;
     }
     if (face >= 0 && face < GetNumberOfSides(part))
     {
         offset.x = tex.GetFace((uint)face).OffsetU;
         offset.y = tex.GetFace((uint)face).OffsetV;
         offset.z = 0.0;
         return offset;
     }
     return offset;
 }
开发者ID:WhiteCoreSim,项目名称:WhiteCore-Dev,代码行数:17,代码来源:LSL_Api.cs


示例14: llRotBetween

        public LSL_Rotation llRotBetween(LSL_Vector a, LSL_Vector b)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
                return new LSL_Rotation();
            //A and B should both be normalized

            LSL_Rotation rotBetween;
            // Check for zero vectors. If either is zero, return zero rotation. Otherwise,
            // continue calculation.
            if (a == new LSL_Vector(0.0f, 0.0f, 0.0f) || b == new LSL_Vector(0.0f, 0.0f, 0.0f))
            {
                rotBetween = new LSL_Rotation(0.0f, 0.0f, 0.0f, 1.0f);
            }
            else
            {
                a = LSL_Vector.Norm(a);
                b = LSL_Vector.Norm(b);
                double dotProduct = LSL_Vector.Dot(a, b);
                // There are two degenerate cases possible. These are for vectors 180 or
                // 0 degrees apart. These have to be detected and handled individually.
                //
                // Check for vectors 180 degrees apart.
                // A dot product of -1 would mean the angle between vectors is 180 degrees.
                if (dotProduct < -0.9999999f)
                {
                    // First assume X axis is orthogonal to the vectors.
                    LSL_Vector orthoVector = new LSL_Vector(1.0f, 0.0f, 0.0f);
                    orthoVector = orthoVector - a * (a.x / LSL_Vector.Dot(a, a));
                    // Check for near zero vector. A very small non-zero number here will create
                    // a rotation in an undesired direction.
                    rotBetween = LSL_Vector.Mag(orthoVector) > 0.0001
                                     ? new LSL_Rotation(orthoVector.x, orthoVector.y, orthoVector.z, 0.0f)
                                     : new LSL_Rotation(0.0f, 0.0f, 1.0f, 0.0f);
                }
                // Check for parallel vectors.
                // A dot product of 1 would mean the angle between vectors is 0 degrees.
                else if (dotProduct > 0.9999999f)
                {
                    // Set zero rotation.
                    rotBetween = new LSL_Rotation(0.0f, 0.0f, 0.0f, 1.0f);
                }
                else
                {
                    // All special checks have been performed so get the axis of rotation.
                    LSL_Vector crossProduct = LSL_Vector.Cross(a, b);
                    // Quarternion s value is the length of the unit vector + dot product.
                    double qs = 1.0 + dotProduct;
                    rotBetween = new LSL_Rotation(crossProduct.x, crossProduct.y, crossProduct.z, qs);
                    // Normalize the rotation.
                    double mag = LSL_Rotation.Mag(rotBetween);
                    // We shouldn't have to worry about a divide by zero here. The qs value will be
                    // non-zero because we already know if we're here, then the dotProduct is not -1 so
                    // qs will not be zero. Also, we've already handled the input vectors being zero so the
                    // crossProduct vector should also not be zero.
                    rotBetween.x = rotBetween.x / mag;
                    rotBetween.y = rotBetween.y / mag;
                    rotBetween.z = rotBetween.z / mag;
                    rotBetween.s = rotBetween.s / mag;
                    // Check for undefined values and set zero rotation if any found. This code might not actually be required
                    // any longer since zero vectors are checked for at the top.
                    if (double.IsNaN(rotBetween.x) || double.IsNaN(rotBetween.y) || 
                        double.IsNaN(rotBetween.z) || double.IsNaN(rotBetween.s))
                    {
                        rotBetween = new LSL_Rotation(0.0f, 0.0f, 0.0f, 1.0f);
                    }
                }
            }
            return rotBetween;
        }
开发者ID:WhiteCoreSim,项目名称:WhiteCore-Dev,代码行数:69,代码来源:LSL_Api.cs


示例15: SetPrimitiveShapeParams

        protected void SetPrimitiveShapeParams(ISceneChildEntity part, int holeshape, LSL_Vector cut, float hollow,
                                               LSL_Vector twist, LSL_Vector taper_b, LSL_Vector topshear, byte fudge)
        {
            ObjectShapePacket.ObjectDataBlock shapeBlock = SetPrimitiveBlockShapeParams(part, holeshape, cut, hollow,
                                                                                        twist);

            shapeBlock.ProfileCurve += fudge;

            if (taper_b.x < 0f)
            {
                taper_b.x = 0f;
            }
            if (taper_b.x > 2f)
            {
                taper_b.x = 2f;
            }
            if (taper_b.y < 0f)
            {
                taper_b.y = 0f;
            }
            if (taper_b.y > 2f)
            {
                taper_b.y = 2f;
            }
            float tempFloat = (float)(100.0d * (2.0d - taper_b.x));
            shapeBlock.PathScaleX = (byte)tempFloat;
            tempFloat = (float)(100.0d * (2.0d - taper_b.y));
            shapeBlock.PathScaleY = (byte)tempFloat;
            if (topshear.x < -0.5f)
            {
                topshear.x = -0.5f;
            }
            if (topshear.x > 0.5f)
            {
                topshear.x = 0.5f;
            }
            if (topshear.y < -0.5f)
            {
                topshear.y = -0.5f;
            }
            if (topshear.y > 0.5f)
            {
                topshear.y = 0.5f;
            }
            tempFloat = (float)(100.0d * topshear.x);
            shapeBlock.PathShearX = (byte)tempFloat;
            tempFloat = (float)(100.0d * topshear.y);
            shapeBlock.PathShearY = (byte)tempFloat;

            part.Shape.SculptEntry = false;
            part.UpdateShape(shapeBlock);
        }
开发者ID:WhiteCoreSim,项目名称:WhiteCore-Dev,代码行数:52,代码来源:LSL_Api.cs


示例16: LSL_Rotation

        public LSL_Rotation llAxes2Rot(LSL_Vector fwd, LSL_Vector left, LSL_Vector up)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
                return new LSL_Rotation();

            double s;
            double tr = fwd.x + left.y + up.z + 1.0;

            if (tr >= 1.0)
            {
                s = 0.5 / Math.Sqrt(tr);
                return new LSL_Rotation(
                    (left.z - up.y) * s,
                    (up.x - fwd.z) * s,
                    (fwd.y - left.x) * s,
                    0.25 / s);
            }
            double max = (left.y > up.z) ? left.y : up.z;

            if (max < fwd.x)
            {
                s = Math.Sqrt(fwd.x - (left.y + up.z) + 1.0);
                double x = s * 0.5;
                s = 0.5 / s;
                return new LSL_Rotation(
                    x,
                    (fwd.y + left.x) * s,
                    (up.x + fwd.z) * s,
                    (left.z - up.y) * s);
            }
            if (FloatAlmostEqual(max,left.y))
            {
                s = Math.Sqrt(left.y - (up.z + fwd.x) + 1.0);
                double y = s * 0.5;
                s = 0.5 / s;
                return new LSL_Rotation(
                    (fwd.y + left.x) * s,
                    y,
                    (left.z + up.y) * s,
                    (up.x - fwd.z) * s);
            }
            s = Math.Sqrt(up.z - (fwd.x + left.y) + 1.0);
            double z = s * 0.5;
            s = 0.5 / s;
            return new LSL_Rotation(
                (up.x + fwd.z) * s,
                (left.z + up.y) * s,
                z,
                (fwd.y - left.x) * s);
        }
开发者ID:WhiteCoreSim,项目名称:WhiteCore-Dev,代码行数:50,代码来源:LSL_Api.cs


示例17: llVecMag

        //This next group are vector operations involving squaring and square root. ckrinke
        public LSL_Float llVecMag(LSL_Vector v)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
                return new LSL_Float();

            return LSL_Vector.Mag(v);
        }
开发者ID:WhiteCoreSim,项目名称:WhiteCore-Dev,代码行数:8,代码来源:LSL_Api.cs


示例18: llVecNorm

 public LSL_Vector llVecNorm(LSL_Vector v)
 {
     if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID))
         return new LSL_Vector();
     return LSL_Vector.Norm(v);
 }
开发者ID:WhiteCoreSim,项目名称:WhiteCore-Dev,代码行数:6,代码来源:LSL_Api.cs


示例19: llGetLandOwnerAt

        public LSL_String llGetLandOwnerAt(LSL_Vector pos)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) 
                return "";

            IParcelManagementModule parcelManagement = World.RequestModuleInterface<IParcelManagementModule>();
            if (parcelManagement != null)
            {
                ILandObject land = parcelManagement.GetLandObject((float)pos.x, (float)pos.y);
                if (land != null)
                    return land.LandData.OwnerID.ToString();
            }
            return UUID.Zero.ToString();
        }
开发者ID:WhiteCoreSim,项目名称:WhiteCore-Dev,代码行数:14,代码来源:LSL_Api.cs


示例20: llTriggerSoundLimited

        public void llTriggerSoundLimited(string sound, double volume, LSL_Vector top_north_east,
                                          LSL_Vector bottom_south_west)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) 
                return;

            double radius1 = (float)llVecDist(llGetPos(), top_north_east);
            double radius2 = (float)llVecDist(llGetPos(), bottom_south_west);
            double radius = Math.Abs(radius1 - radius2);
            m_host.SendSound(KeyOrName(sound, AssetType.Sound, true).ToString(), volume, true, 0, (float)radius);
        }
开发者ID:WhiteCoreSim,项目名称:WhiteCore-Dev,代码行数:11,代码来源:LSL_Api.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# LSL_Types.list类代码示例发布时间:2022-05-24
下一篇:
C# LSL_Types.LSLString类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap