CGTalk > Software Specific Forums > Autodesk 3ds max > 3dsMax SDK and MaxScript
To minimize the ads you see on this page create a CGTalk account and log in HERE
Thread Closed share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 05-13-2008, 08:30 PM   #1
reForm
Expert
portfolio
Patrick Macdonald
CG Artist
reForm Studios
London, United Kingdom
 
Join Date: Apr 2005
Posts: 548
Problem with applying Chunk pivot orientation to particles

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?

Code:
on Proceed pCont do ( t = pCont.getTimeStart() as float if t > 0 do ( NumChunks = ChunksArray.count tt = ((t/160)) if tt < NumChunks do ( pCont.AddParticle() 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?
__________________
Patrick Macdonald
Lighting TD : http://reformstudios.com
Developer of Mission Control
, the spreadsheet editor for 3ds Max
 
Old 05-14-2008, 09:09 AM   #2
davestewart
Repeat-customer
 
davestewart's Avatar
Dave Stewart
Animator / scripter
United Kingdom
 
Join Date: Sep 2004
Posts: 488
Hey Patrick,
Can you post a scene?
__________________
Portfolio | Keyframes and Code
 
Old 05-14-2008, 09:59 AM   #3
reForm
Expert
portfolio
Patrick Macdonald
CG Artist
reForm Studios
London, United Kingdom
 
Join Date: Apr 2005
Posts: 548
http://www.reformstudios.com/03-res...low_problem.max

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.

p.
__________________
Patrick Macdonald
Lighting TD : http://reformstudios.com
Developer of Mission Control
, the spreadsheet editor for 3ds Max
 
Old 05-14-2008, 12:51 PM   #4
davestewart
Repeat-customer
 
davestewart's Avatar
Dave Stewart
Animator / scripter
United Kingdom
 
Join Date: Sep 2004
Posts: 488
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?)

Cheers,
Dave
__________________
Portfolio | Keyframes and Code
 
Old 05-14-2008, 01:09 PM   #5
reForm
Expert
portfolio
Patrick Macdonald
CG Artist
reForm Studios
London, United Kingdom
 
Join Date: Apr 2005
Posts: 548
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!
__________________
Patrick Macdonald
Lighting TD : http://reformstudios.com
Developer of Mission Control
, the spreadsheet editor for 3ds Max
 
Old 05-14-2008, 01:41 PM   #6
davestewart
Repeat-customer
 
davestewart's Avatar
Dave Stewart
Animator / scripter
United Kingdom
 
Join Date: Sep 2004
Posts: 488
Hey Patrick,

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
__________________
Portfolio | Keyframes and Code
 
Old 05-14-2008, 02:02 PM   #7
reForm
Expert
portfolio
Patrick Macdonald
CG Artist
reForm Studios
London, United Kingdom
 
Join Date: Apr 2005
Posts: 548


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.
__________________
Patrick Macdonald
Lighting TD : http://reformstudios.com
Developer of Mission Control
, the spreadsheet editor for 3ds Max

Last edited by reForm : 05-14-2008 at 02:04 PM.
 
Old 05-14-2008, 02:02 PM   #8
CGTalk Moderation
Lord of the posts
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,481
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 02:25 AM.


Powered by vBulletin
Copyright ©2000 - 2016, Jelsoft Enterprises Ltd.