View Full Version : Problem with applying Chunk pivot orientation to particles
05-13-2008, 08:30 PM
I'm trying to use object-chunks pflow birth script but with the added joy of being able to retain the pivot orientation of the source mesh's within the particle.
When pflow creates the chunks, the particle rotations are all [0 0 0] rather than the rotation that I have specified by rotating the mesh pivots.
The script below is getting close to what I want but some objects are 180 degrees off of what they should be if I was to local-rotate the source objects. I assume its because I'm using euler and quat values when I need to use angleaxis values.
Any ideas how I can fix the math to get the result I'm looking for?
on Proceed pCont do
t = pCont.getTimeStart() as float
if t > 0 do
NumChunks = ChunksArray.count
tt = ((t/160))
if tt < NumChunks do
pCont.particleIndex = pCont.NumParticles()
pCont.particleAge = 0
pCont.particleTM = ChunksArray[tt].objecttransform
pCont.particleShape = ChunksArray[tt].mesh
a = ChunksArray[tt].objectOffsetRot as eulerangles
aq = ChunksArray[tt].objectOffsetRot
rq = (eulerangles 90 0 0) as quat
nr = (inverse aq * rq) as eulerangles
pCont.particleorientation = [ nr.x,nr.y,nr.z]
My other thought is I need to normalise the quat values.... but then again, I dont actually understand what normalising a quat value does! Can anyone care to explain what it does, and in what situations you would want to normalise quat values?
05-14-2008, 09:09 AM
Can you post a scene?
05-14-2008, 09:59 AM
When you run the anim you can see that the corner columns rotate as expected, at 45 degrees, as defined by the pivot I rotated on the source mesh objects. The 2nd and 3rd particles that appear are 180 degrees from where they should end up.
If you select all the Box* objects and do a local rotate 90 on the x axis, you should be able to see the orientations that the particles should take when rotated 90 degrees.
Thanks for taking a look.
05-14-2008, 12:51 PM
Hmm... you may need to explain again what you are trying to achieve.
I looked at the mesh pivots, and they are all aligned to the world XYZ, so I'm not sure what you're asking? Where do these mysterious 45 degree rotations come from - are they intentional? What's their purpose?
If you can describe what you want to be seeing, I might be able to help.
(I presume that you don't just want to align the particles with the original mesh, or you would have done that by now, yeah?)
05-14-2008, 01:09 PM
Argh , sorry about that. I must have reset the pivots before saving the maxfile.
I've replaced the original file on the server with one that should have the pivots rotated. So you should be able to reload it using the link above.
The look I want in this example is for the outer columns to fold out like petals. If you select the boxes and use rotate on the local x axis, the outer columns should all rotate away from the building core. This is because I have rotated the pivot on each side so that the y-axis is always pointing in to the centre of the collection.
As you can see, the corner columns seem to match the behaviour you get when you manually rotate the mesh objects, but the inner columns rotate in the opposite direction.
Sorry for not explaining this very clearly, its difficult to put into words!
05-14-2008, 01:41 PM
I had a quick look but I probably don't have time to tinker properly (shame).
One thing I definately would do would be to create a new scene with maybe 6 particles oriented in the unique source directions, definately have them all birth at the same time, then add the next event to make them rotate in sync.
At the moment it's just too confusing with 184 particles being born one by one, then when I put in the rotate event, all rotating over each other!
Good luck, sorry I can't be any help right now :)
05-14-2008, 02:02 PM
The red verticals are the source meshes. The green objects are the particles spawned with a [90, 0, 0] rotation applied using the birth script above.
As you can see, the particle, when rotated through 90 degrees in the x direction, should point away from the y-pivot axis (green).
The rotations are arbitary; I just want to see how to make a particle rotate by x-degrees match the source mesh thats rotated x-degrees. The problem is that by default the particle orientation is 0,0,0, even when an source objects pivot has been rotated.
05-14-2008, 02:02 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.