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


C# LSL_Types.Vector3类代码示例

本文整理汇总了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类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

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

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

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

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

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

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


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