https://defold.com/ref/vmath/#vmath.quat_axis_angle:v-angle
Hello! I don’t have deep education in math.
I have understood what is quanterion with Blender and Youtube explanation.
But Defold’s vector maths uses matrices.
What is matrices in vector math?
How can I rotate quaterions and find look-forward vector?
Linear algebra (matrices and vectors) for game development is not hard. But probably this can directly help you
Ciao!
Thanx! I did find an example
p = p + vmath.rotate(rot, move_amount)
But quaternions are very new and difficult for me.
Absolutly unexectedly Defold vector math is based by quats (for me).
However, it’s better for accuracy of calculating.
However, I think, it’s not bad idea to add function
(with normalized vector returns and euler input):
look_forward(euler); look_backward(euler); look_left(euler); look_right(euler);
look_bottom(euler); look_up(euler).
I will make feature request about it.
These kind of functions should not be created in the engine core, but instead in a utility library that can be shared in the asset portal.
A matrix is a combination of vectors. A matrix4
in Defold is four vector4
s.
Crossposting from the feature request thread, a rotation matrix m
contains these vectors:
local right = vmath.vector3(m.c0.x, m.c1.x, m.c2.x)
local up = vmath.vector3(m.c0.y, m.c1.y, m.c2.y)
local back = vmath.vector3(m.c0.z, m.c1.z, m.c2.z)