View Full Version : matrix3 values

04 April 2009, 10:44 AM

How can I change the value of the matrix rows.
for example :
$.transform return matrix3 [a,b,c] , [d,e,f] , [g,h,i] , [j,k,l]
that become
matrix3 [-a,b,c] , [-d,e,f] , [-g,h,i] , [-j,k,l]

thank you


04 April 2009, 11:33 AM
Hi Arno,
from MaxScript Reference, under "Matrix3 Values":

When working with object transformation matrix3 values, the rows and their sub-elements cannot be modified directly. To change a row or an element of the row, assign the matrix3 value to a user variable first, modify the matrix3 rows by assigning to the variable and then assign the variable back to the .transform property of the original object.
To do what you need, I'd go with this:

tm = $.transform

tmNew = (Matrix3 [-tm[1][1], tm[1][2], tm[1][3]] \
[-tm[2][1], tm[2][2], tm[2][3]] \
[-tm[3][1], tm[3][2], tm[3][3]] \
[-tm[4][1], tm[4][2], tm[4][3]] )

$.transform = tmNew
- Enrico

04 April 2009, 12:10 PM
you can also do this:
a = matrix3 [1,2,3] [4,5,6] [7,8,9] [1,1,1]
b = matrix3 [-1,0,0] [0,1,0] [0,0,1] [0,0,0]
c = a * b

04 April 2009, 12:31 PM
thanks a lot,

I will use this to match the transform of an world mirrored object.


CGTalk Moderation
04 April 2009, 12:31 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.