odie
November 14, 2016, 3:32pm
1
Hi there,
I am new to Panda3D and I was wondering how to perform a matrix-vector multiplication in a pythonic and “pandaic” way.
>>> myvec = Vec3F(0,0,1)
>>> mymat = Mat3F(1,0,0,0,1,0,0,0,1) # identity matrix
>>> mymat * myvec
TypeError: unsupported operand type(s) for *: 'panda3d.core.LMatrix3f' and 'panda3d.core.LVector3f'
Thanks for answers and suggestions!
wezu
November 14, 2016, 5:37pm
2
I for one never needed to do something like that in python, but looking at the docs ( panda3d.org/reference/devel … .LMatrix3f ) I think you would want the xform method of LMatrix3f
>>> myvec = Vec3F(0,0,1)
>>> mymat = Mat3F(1,0,0,0,1,0,0,0,1)
>>> mymat.xform(myvec)
LVecBase3f(0, 0, 1)
odie
November 15, 2016, 9:16am
3
That is exactly what I need, thank you, wezu!
I just did not expect the name xform for a multiplication