Problem assigning rotation to the particlevector

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Display Modes
  08 August 2010
Problem assigning rotation to the particlevector

I hope someone can help,

I'm trying to use a pflow script to have object chunks return to their position AND rotation.
The position is working fine if I set the pCont.particleVector = ChunksArray[i].pos
But... if the chunks are spinning, they do not return to their original rotations.

Setting the particlevector to ChunchsArray[i].transform causes the script to fail....

pCont.particleIndex = i
vpos = ChunksArray[i].transform
pCont.particleVector = vpos


Does the particlevector allow you to save the rotation aswell as the position of a particle chunk?

If so, how do I assign the rotation to the particlevector?

Here's my birthscript.

on ChannelsUsed pCont do 
( 
pCont.useAge = true 
pCont.useTM = true 
pCont.useVector = true 
) 

on Init pCont do 
( 
global ChunksArray = $Teapot* as array 
global TM_Reset 
-- TM_Reset = undefined 

if ChunksArray != undefined do 
( 
if TM_Reset == undefined do TM_Reset = true 
if TM_Reset do 
( 
Global ChunksArray_TM = for i in ChunksArray collect i.transform 
TM_Reset = false 
) 
) 
) 

on Proceed pCont do 
( 
t = pCont.getTimeStart() as float 
NumChunks = ChunksArray.count 

if t < 0 do 
( 
for i = 1 to NumChunks do 
( 
pCont.AddParticle() 
pCont.particleIndex = pCont.NumParticles() 
pCont.particleAge = 0 
pCont.particleTM = ChunksArray_TM[i] 
pCont.particleIndex = i 
vpos = ChunksArray[i].pos 
pCont.particleVector = vpos 
) 
) 

) 

on Release pCont do ()



Thanks for any help!
Cheers
p.
__________________
Patrick Macdonald
Lighting TD : http://reformstudios.com
Developer of Mission Control
, the spreadsheet editor for 3ds Max
 
  08 August 2010
Yes you can store rotation but the particleVector channel only holds one set of vector values, in this case you need at least 2, one for rotation and one for position. Seems we talked about this recently and I am trying to find a sample I whipped up.

A possible solution is to use the particleMatrix channel instead. This gives you the option to store up to 4 sets of vector data, 12 floats, or a single matrix. Just be aware that you need to assign your rotation and position values to a variable before inserting them into the matrixChannel.

You have box#3 don't you? It is way simpler/faster in a data op. You'd simply add a new in event piped to a input standard->position and a input standard->rotation, convert to matrix (select an appropriate channel for each) the out to a output standard-> Script Matrix or out to there own custom data channels for use later.

Then just recall these values in another data op downstream.

I couldn't find the scripted example I did earlier so I made another one. It uses both a Vector and a Matrix channel with a Go To Rotation and a Find Target.

EDIT: argh, something is wrong with the way particleOrientation is storing, it doesn't appear to be correct, I inserted a duplicate flow using data ops work work as they should, the scripted version is bungled for some reason. Working on it...

EDIT EDIT: Seems to be a time accuracy issue, just guessing

Anyway here is that scripted version with a simple box#3 setup in it.
Max2010
Attached Files
File Type: zip max2010_PF_mxsVectorPosMatrixRot_01.zip (33.2 KB, 33 views)
__________________
poof ~>Vimeo<~

Last edited by JohnnyRandom : 08 August 2010 at 09:11 PM.
 
  08 August 2010
Hey Jonny,
Thanks so much for taking a look at this for me!
I tried your two pflows but I'm struggling to get then to work adequately with object chunks (through a birth script).
Using the data operators, the rotations appear to be working now, but not the positions!
I also noticed in your sample maxfile there are two problems: the rotation doesn't appear to smoothly rotate back to the original orientation, rather it snaps into place in the last frame before stopping. The position also seems inaccurate, but I think you already noticed this... and yes it looks like it's a timing issue.

I've attached your original scene but adjusted to object chunks, and my other scene using object chunks... (max2011 and 2009 respectively).
http://www.reformstudios.com/03-res...m_Lozenge01.zip
I wonder if any other pflow gurus can shed some light on where we might be going wrong?

Thanks again!
Attached Files
File Type: zip max2010_PF_mxsVectorPosMatrixRot_02.zip (32.0 KB, 19 views)
__________________
Patrick Macdonald
Lighting TD : http://reformstudios.com
Developer of Mission Control
, the spreadsheet editor for 3ds Max
 
  08 August 2010
No worries, be better if I could nail it down.

Me and rotations we are so tight...I think they hate me

Anyway, I tried to emulate the script version as close as possible with box#3 (as simple as it is). To get exact Position/Rotation/Scale using the Transform Matrix never seems to fail. So input the TM in the first op (while leaving the Particle Vector for use with Find Target) Output New it to a new global channel and recall it in the last event (everything should then match up tick for tack). The slow rotation in can be fixed with a Go To Rotation test, I had one but omitted it to make sure the operators were behaving correctly.

hmm, couldn't seem to grab the scene file?
__________________
poof ~>Vimeo<~
 
  08 August 2010
Looked at your scene, as mentioned switch the Euler Angles to TM-Matrix instead, rewire the final data op to reflect the change to TM.

This seems to work ok: Shot_150_Forum_Lozenge02.zip
__________________
poof ~>Vimeo<~
 
  08 August 2010
You, Sir, are a genius... ! That worked perfectly.... what a result!
Thanks again!
__________________
Patrick Macdonald
Lighting TD : http://reformstudios.com
Developer of Mission Control
, the spreadsheet editor for 3ds Max
 
  08 August 2010
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



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:17 AM.


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