Skip to content

Question on PalmNormal.Roll #1278

Answered by MattGrayUL
hongkai0818 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, thanks for the question and thanks for trying out 6.0.0

You can see how we calculated these by grabbing the code from Vector in the Legacy Package

Here is a static utility class that will produce the same results from unity's Vector3:

using UnityEngine;

public static class Vector3Utils
{
    public static float GetRoll(this Vector3 v)
    {
        return (float)System.Math.Atan2(v.x, -v.y);
    }

    public static float GetPitch(this Vector3 v)
    {
        return (float)System.Math.Atan2(v.y, -v.z);
    }

    public static float GetYaw(this Vector3 v)
    {
        return (float)System.Math.Atan2(v.x, -v.z);
    }
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@hongkai0818
Comment options

Answer selected by hongkai0818
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants