I have to say that I’m new to panda3D. I have an object that I need to rotate and I have a rotation matrix, is there a way to use it to rotate the object instead of using yaw, roll and pitch with the setHpr function? I already managed to rotate some sets of points simply using algebra, I just wanted to know if I could do the same with objects.
Hello, I am glad to see you here. Here is an example of matrix rotation in Panda3D using a high-level method.
from panda3d.core import LMatrix4f, Vec3
from direct.showbase.ShowBase import ShowBase
panda = base.loader.load_model("panda")
# Getting the current object matrix.
#curr_mat = panda.get_mat()
# Creating a new matrix.
my_mat = LMatrix4f(1,0,0,0,
# Rotation of the matrix by 90 degrees on the Z axis.
result = my_mat.rotate_mat(90.0, Vec3(0, 0, 1))
demo = TestMat()
Hi, thanks for the reply! How would it work if I want to apply a specific rotation matrix and not like in the example you provided to simply rotate by 90 degrees on an axis?
Edit: I managed to do it, thanks!