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

Function EulerToQuat

engine/script/src/script_vmath.cpp:2691–2705  ·  view source on GitHub ↗

converts euler angles into a quaternion * * Converts euler angles (x, y, z) in degrees into a quaternion * The error is guaranteed to be less than 0.001. * If the first argument is vector3, its values are used as x, y, z angles. * * @name vmath.euler_to_quat * @param x [type:number|vector3] rotation around x-axis in degrees or vector3 with euler angles in degrees

Source from the content-addressed store, hash-verified

2689 * ```
2690 */
2691 static int EulerToQuat(lua_State* L)
2692 {
2693 if (lua_type(L, 1) == LUA_TNUMBER)
2694 {
2695 float x = (float) luaL_checknumber(L, 1);
2696 float y = (float) luaL_checknumber(L, 2);
2697 float z = (float) luaL_checknumber(L, 3);
2698 PushQuat(L, dmVMath::EulerToQuat(dmVMath::Vector3(x, y, z)));
2699 return 1;
2700 }
2701
2702 Vector3* v = CheckVector3(L, 1);
2703 PushQuat(L, dmVMath::EulerToQuat(*v));
2704 return 1;
2705 }
2706
2707 static const luaL_reg methods[] =
2708 {

Callers 7

UpdateEulerToRotationFunction · 0.50
UpdateEulerToRotationFunction · 0.50
SetNodePropertyFunction · 0.50
LuaSetRotationFunction · 0.50
LuaSetEulerFunction · 0.50
SetNodeFunction · 0.50
SetUpMethod · 0.50

Calls 5

lua_typeFunction · 0.85
luaL_checknumberFunction · 0.85
PushQuatFunction · 0.85
CheckVector3Function · 0.85
Vector3Class · 0.50

Tested by 1

SetUpMethod · 0.40