Point 3 value into Particle Matrix?


#1

I need to store a Point 3 value but my ParticleVector channel is being used. How can I put a point 3 value into the ParticleMatrix channel for re-calling later?

    pCont.particleIndex = i
    pCont.ParticleMatrix.row1 = pCont.ParticlePosition
    print pCont.ParticlePosition
    print pCont.ParticleMatrix    

Gives me…

[-32.6154,39.168,5.4221]
(matrix3 [1,0,0] [0,1,0] [0,0,1] [0,0,0])

What have I missed?


#2

You missed the big red note in the MAXScript Reference in the Matrix3 Value topic:

Matrix3 Values [left]NOTE:
[/left]
[left]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.
[/left]
[left]DOES NOTHING:
[/left]
[left]
[/left]
[left]$Teapot01.transform.row4 = [10.0,20.0,30.0]
[/left]
[left]
[/left]
[left]WORKS:
[/left]
[left]
[/left]
[left]myTransform = $Teapot01.transform
[/left]
[left]myTransform.row4 = [10.0,20.0,30.0]
[/left]
[left]$Teapot01.transform = myTransform
[/left]
[left]


So in your case, create a temp. variable, get the matrix3 value into it, modify the row1 of the variable and assign back to the channel. Or simply create a matrix3 value with the row1 you have and nothing in the rest:

pcont.particleMatrix = matrix3 yourPoint3Value [0,0,0] [0,0,0] [0,0,0] [/left]


#3

As always, my Sincere Thanks Bobo.


#4

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.