docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class QuaternionCompressor

    A Smallest Three Quaternion Compressor Implementation

    Inheritance
    object
    QuaternionCompressor
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: Unity.Netcode
    Assembly: solution.dll
    Syntax
    public static class QuaternionCompressor
    Remarks

    Explanation of why "The smallest three": Since a normalized Quaternion's unit value is 1.0f: xx + yy + zz + ww = MM (where M is the magnitude of the vector) If w was the largest value and the quaternion is normalized: M = 1.0f (which M * M would still yield 1.0f) ww = MM - (xx + yy + zz) or Mathf.Sqrt(1.0f - (xx + yy + zz)) w = Math.Sqrt(1.0f - (xx + yy + zz)) Using the largest the number avoids potential loss of precision in the smallest three values.

    Methods

    Name Description
    CompressQuaternion(ref Quaternion)

    Compresses a Quaternion into an unsigned integer

    DecompressQuaternion(ref Quaternion, uint)

    Decompress a compressed quaternion

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)