Answers for "rotate vector unit"

C#
6

unity rotate vector

Vector3 rotated = Quaternion.AngleAxis(-45, Vector3.up) * vector;
Posted by: Guest on May-23-2020
0

Rotate Vector by an angle

var rotateVector = function(vec, ang)
{
    ang = -ang * (Math.PI/180);
    var cos = Math.cos(ang);
    var sin = Math.sin(ang);
    return new Array(Math.round(10000*(vec[0] * cos - vec[1] * sin))/10000, Math.round(10000*(vec[0] * sin + vec[1] * cos))/10000);
};
Posted by: Guest on June-15-2021

C# Answers by Framework

Browse Popular Code Answers by Language