MCPcopy Create free account
hub / github.com/defold/defold / Quat_FromTo

Function Quat_FromTo

engine/script/src/script_vmath.cpp:1242–1248  ·  view source on GitHub ↗

creates a quaternion to rotate between two unit vectors * * The resulting quaternion describes the rotation that, * if applied to the first vector, would rotate the first * vector to the second. The two vectors must be unit * vectors (of length 1). * * [icon:attention] The result is undefined if the two vectors point in opposite directions * * @name vma

Source from the content-addressed store, hash-verified

1240 * ```
1241 */
1242 static int Quat_FromTo(lua_State* L)
1243 {
1244 Vector3* v1 = CheckVector3(L, 1);
1245 Vector3* v2 = CheckVector3(L, 2);
1246 PushQuat(L, Quat::rotation(*v1, *v2));
1247 return 1;
1248 }
1249
1250 /*# creates a quaternion to rotate around a unit vector
1251 *

Callers

nothing calls this directly

Calls 2

CheckVector3Function · 0.85
PushQuatFunction · 0.85

Tested by

no test coverage detected