{!See https://docs.google.com/document/d/1takg_GmIBBKKTj-GHZCwzxohpQz7Bhekivkk72kYMtE/edit for reference implementation of OneTrust, dataLayer and GTM} {!OneTrust Cookies Consent} {!OneTrust Cookies Consent end} {!dataLayer initialization push} {!dataLayer initialization push end} {!Google Tag Manager} {!Google Tag Manager end} Method CalculateTwistAngle | Unity Physics | 1.1.0-pre.3
docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method CalculateTwistAngle

    CalculateTwistAngle(quaternion, int)

    Returns the twist angle of the swing-twist decomposition of q about i, j, or k corresponding to index = 0, 1, or 2 respectively. Full calculation for readability: float invLength = RSqrtSafe(dot * dot + w * w); float sinHalfAngle = dot * invLength; float cosHalfAngle = w * invLength; Observe: invLength cancels in the tan^-1(sin / cos) calc, so avoid unnecessary calculations.

    Declaration
    public static float CalculateTwistAngle(quaternion q, int twistAxisIndex)
    Parameters
    Type Name Description
    quaternion q

    A quaternion to process.

    int twistAxisIndex

    Zero-based index of the twist axis.

    Returns
    Type Description
    float

    The calculated twist angle.

    In This Article
    Back to top
    Copyright © 2023 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)