示例#1
0
        public Float4 quatToEuler(Float4 q)
        {
            Float4 euler;

            euler.y = Convert.ToSingle(Math.Asin(2.0 * ((q.x * q.z) - (q.w * q.y))));

            if (euler.y == 90.0)
            {
                euler.x = Convert.ToSingle(2.0 * Math.Atan2(q.x, q.w));
                euler.z = 0;
            }
            else if (euler.y == -90.0)
            {
                euler.x = Convert.ToSingle(-2.0 * Math.Atan2(q.x, q.w));
                euler.z = 0;
            }
            else
            {
                euler.x = Convert.ToSingle(Math.Atan2(2.0 * ((q.x * q.y) + (q.z * q.w)), 1.0 - (2.0 * ((q.y * q.y) + (q.z * q.z)))));
                euler.z = Convert.ToSingle(Math.Atan2(2.0 * ((q.x * q.w) + (q.y * q.z)), 1.0 - (2.0 * ((q.z * q.z) + (q.w * q.w)))));
            }

            euler.w = 0;

            return euler;
        }
示例#2
0
		public static Vector3 Float4ToVector3(Float4 vec) {
			return new Vector3(vec.x, vec.y, vec.z);
		}
示例#3
0
		public static Quaternion Float4ToQuaternion(Float4 vec) {
			return new Quaternion(vec.x, vec.y, vec.z, vec.w);
		}
 public static Vector3 Float4ToVector3(Float4 vec)
 {
     return(new Vector3(vec.x, vec.y, vec.z));
 }
 public static Quaternion Float4ToQuaternion(Float4 vec)
 {
     return(new Quaternion(vec.x, vec.y, vec.z, vec.w));
 }
示例#6
0
 public void FillFromNetworkBuffer(ref Byte[] buffer, int i)
 {
     int offset = 104 + i * 176;
     pos = NetworkReaderHelper.ReadFloat4(ref buffer, offset);
     vel = NetworkReaderHelper.ReadFloat4(ref buffer, offset + 16);
     accel = NetworkReaderHelper.ReadFloat4(ref buffer, offset + 32);
     quat = NetworkReaderHelper.ReadFloat4(ref buffer, offset + 48);
     angvel = NetworkReaderHelper.ReadFloat4(ref buffer, offset + 64);
     angaccel = NetworkReaderHelper.ReadFloat4(ref buffer, offset + 80);
     handle_pos = NetworkReaderHelper.ReadFloat4(ref buffer, offset + 96);
     handle_vel = NetworkReaderHelper.ReadFloat4(ref buffer, offset + 112);
     handle_accel = NetworkReaderHelper.ReadFloat4(ref buffer, offset + 128);
     pad.FillFromNetworkBuffer(ref buffer, i);
     timestamp = NetworkReaderHelper.ReadInt64(ref buffer, offset + 152);
     temperature = NetworkReaderHelper.ReadFloat(ref buffer, offset + 160);
     camera_pitch_angle = NetworkReaderHelper.ReadFloat(ref buffer, offset + 164);
     tracking_flags = NetworkReaderHelper.ReadUint32(ref buffer, offset + 168);
 }