Ejemplo n.º 1
0
Archivo: Util.cs Proyecto: yooyke/work
        public static float CalcTargetFromPosition(ref Vector3D target, ref Vector3D position, ref Vector3D? front)
        {
            Vector3D f = new Vector3D(1, 0, 0);
            if (front != null)
                f = (Vector3D)front;

            Vector3D tar = target - position;
            tar.Z = 0;
            if (tar.LengthSQ > 0)
                tar.Normalize();

            float dotAngle;
            dotAngle = f.DotProduct(tar);
            //Vector3D.Dot(ref front, ref tar, out dotAngle);

            Vector3D cross;
            cross = f.CrossProduct(tar);
            //Vector3D.Cross(ref front, ref tar, out cross);

            float angle = (float)Math.Acos(dotAngle);
            if (cross.Z < 0)
                angle = MathHelper.TwoPI - angle;

            return angle;
        }
Ejemplo n.º 2
0
 public void RecalculateD(Vector3D mpoint)
 {
     D = -mpoint.DotProduct(Normal);
 }
Ejemplo n.º 3
0
        private void RegisterLoginResponseHandler(bool loginSuccess, bool redirect, string message, string reason, LoginResponseData replyData)
        {
            Vector3D forward = new Vector3D(1, 0, 0);
            Vector3D target = new Vector3D(replyData.LookAt.X, replyData.LookAt.Z, replyData.LookAt.Y);

            float radHeading = forward.DotProduct(target);
            Reference.Viewer.AvatarManager.RadHeading = radHeading * (float)Math.PI;
        }