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


C# ISceneChildEntity.startLookAt方法代码示例

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


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

示例1: LookAt

        private void LookAt(LSL_Vector target, double strength, double damping, ISceneChildEntity obj)
        {
            // Determine where we are looking from
            LSL_Vector from = new LSL_Vector(obj.GetWorldPosition());

            // Work out the normalised vector from the source to the target
            LSL_Vector delta = llVecNorm(target - from);
            LSL_Vector angle = new LSL_Vector(0, 0, 0)
                                   {
                                       x = llAtan2(delta.z, delta.y) - ScriptBaseClass.PI_BY_TWO,
                                       y = llAtan2(delta.x, llSqrt((delta.y*delta.y) + (delta.z*delta.z)))
                                   };

            // Calculate the yaw
            // subtracting PI_BY_TWO is required to compensate for the odd SL co-ordinate system

            // Calculate pitch

            // we need to convert from a vector describing
            // the angles of rotation in radians into rotation value

            LSL_Types.Quaternion rot = llEuler2Rot(angle);
            //If the strength is 0, or we are non-physical, set the rotation
            if (strength == 0 || obj.PhysActor == null || !obj.PhysActor.IsPhysical)
                SetLinkRot(obj, rot);
            else
                obj.startLookAt(Rot2Quaternion(rot), (float) strength, (float) damping);
        }
开发者ID:velus,项目名称:Async-Sim-Testing,代码行数:28,代码来源:LSL_Api.cs

示例2: LookAt

        private void LookAt(LSL_Vector target, double strength, double damping, ISceneChildEntity obj)
        {
            // Determine where we are looking from
            LSL_Vector from = new LSL_Vector(obj.GetWorldPosition());

            // The following code bit was written by Dahlia
            // from the Opensimulator Core Team. Thank you for fixing this issue

            // normalized direction to target
            LSL_Vector dir = llVecNorm(target - from);

            // use vertical to help compute left axis
            LSL_Vector up = new LSL_Vector(0.0, 0.0, 1.0);

            // find normalized left axis parallel to horizon
            LSL_Vector left = llVecNorm(LSL_Vector.Cross(up, dir));

            // make up orthogonal to left and direction
            up = LSL_Vector.Cross(dir, left);

            // compute rotation based on orthogonal axes
            LSL_Rotation rot = new LSL_Rotation(0.0, 0.707107, 0.0, 0.707107) * llAxes2Rot(dir, left, up);

            // End codebit

            //If the strength is 0, or we are non-physical, set the rotation
            if (strength == 0 || obj.PhysActor == null || !obj.PhysActor.IsPhysical)
                SetLinkRot(obj, rot);
            else
                obj.startLookAt(Rot2Quaternion(rot), (float)strength, (float)damping);
        }
开发者ID:VirtualReality,项目名称:Universe,代码行数:31,代码来源:LSL_Api.cs


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