View Full Version : particle goalOffset in local space?

03 March 2011, 04:12 AM
Hi all,

Just looking for a little help with goal offsets for particles. I have some text drifting through a scene which I am using the text as a goal for some particles. I want to have the particles offset from from the z axis of the text. From what I understand goalOffset only works on world space not local space, so if I simply offset them in z, then the result isnt really what I want as the text rotates within the scene. So I guess what I am looking for is a way to offset the particles along the z axis of their goal object as opposed to the the worldspace z axis.

Any suggestions would be very much appreciated as I am not yet very competant with mel (something I am working on, hehe).

03 March 2011, 05:34 AM
You need to get direction of your object(X,Y,Z) as vector.

float $matrix[]=`getAttr object.matrix`; //local matrix of object
vector $vecX=<<$matrix[0],$matrix[1],$matrix[2]>>; //X axis
vector $vecY=<<$matrix[4],$matrix[5],$matrix[6]>>;//Y
vector $vecZ=<<$matrix[8],$matrix[9],$matrix[10]>>;//Z
goalOffset=$vecZ;//offset in Z

03 March 2011, 06:16 AM
Ahh ok, I think I see what you have going on in there, Thanks a lot ginodauri. I added a simple rand function to the offset as well I have it working in my secene, and although I haven't got it working perfectly (particles still not quite alligning with the goal object in Z), I think you have given me a good starting point for further research.

Thanks again :)

CGTalk Moderation
03 March 2011, 06:16 AM
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.