How to convert Vector3 to Quaternion?

时间:2016-04-21 21:49:07

标签: c# unity3d

Trying to figure out how to convert a Vector3 to a Quaternion. Also will it be OK if I need to constantly update said value?

1 个答案:

答案 0 :(得分:4)

You can quite easily convert a Vector3 to a quaternion by using, for example, this:

Quaternion quaternion = Quaternion.Euler(v.x, v.y, v.z);

So, for example, that's

Quaternion rot = Quaternion.Euler(V3.x, V3.y, V3.z);

That should do it!