Matrix - Vector product


19-10-2009 09:32:26

Hello, I have to port in Python this code snippet:

but when I execute this instruction:

eyeSpacePos = camera.getViewMatrix( True ) * pos

(that is the first line of ProjectPos function) I obtain:

File "C:\...\", line XX, in projectPos
eyeSpacePos = camera.getViewMatrix( True ) * pos
TypeError: unsupported operand type(s) for *: 'Matrix4' and 'Vector2'

How can I solve this? Thanks!


19-10-2009 10:03:51

Suspect you have something wrong with your code as 'pos' is meant to be a Vector3 not a Vector2..

Multiplying a Matrix4 by a Vector3 is supported, however multiplying by Vector2 is not..



19-10-2009 10:47:00

You're right! I've fixed! Thank you!! ^_^