Need MEL script to control Particle Collisions

Become a member of the CGSociety

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

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  10 October 2012
Need MEL script to control Particle Collisions

I'm using particles to simulate light and I need to set up a collision event that allows me to change the particle's direction with an equation.



For this, I need to establish a variable equal to angle which the particle strikes the object at (or maybe multiple objects/impacts) but I don't know how to get Maya to give up this information.

Ideas?
 
  10 October 2012
The Java applet on this page does exactly what I'd like to reproduce - but I'm not sure how to establish the incident angle.

http://www.olympusmicro.com/primer/...ngle/index.html
 
  10 October 2012
Hi Kristian.

You can get what need with nearesPointOnMesh - node and your particle's velocity.

Connect your mesh's worldMesh -> nearesPointOnMesh.inMesh and you can query
the normal with providing a position on the mesh.

Does this help?


/Risto
__________________
- Oh no, it's me -
 
  10 October 2012
Thanks!

It's a point in the right direction, but I'm going to have to do a lot of work to figure out how to structure that into a function which determines the direction.

I can see how with the object plane's translate co-ordinates I should be able to calculate the direction it is facing in relation to my particles direction (past and current locations) but it seems like the long way around - and I'm not sure I have the skills to code all that together within my timeframe.

It strikes me however that Maya automatically calculates which direction to send the particle after impact, and this is equal to the angle with which it was struck. If I can find the var/attribute for that angle, I can multiply it by a new variable (determined by the index of refraction I assign to the object and an if/else statement to determine critical angle) to give me the resulting angle of refraction.

I'm not sure if this method is entirely possible, but it seems like the way to approach the problem.
 
  10 October 2012
Would this help?

http://www.3dkingdoms.com/weekly/weekly.php?a=2

Since you now have the velocity vector and a surface normal vector...

I must ask, can you write MEL at all?

/risto
__________________
- Oh no, it's me -
 
  10 October 2012
I've changed the behaviour of the odd particle with it, but that's about it. Pretty much all of my programming has been in ActionScript.
 
  10 October 2012
So do you need help with this ?


/risto
__________________
- Oh no, it's me -
 
  10 October 2012
Might this help you, Kristian ?

There should be a maya 2011 ascii file attached.

You'll find a refrValue - attribute in particle1-node, which acts as "refractive index" .

Look up the particle expression and you'll get hang of it.

Ask me if you have more questions.

Cheers,

/Risto

ps: and if you are getting paid for this, a little commission wouldn't be so bad... ;-D just kidding
Attached Files
File Type: zip refract_particles.zip (8.0 KB, 22 views)
__________________
- Oh no, it's me -
 
  10 October 2012
Talking

Haha - You're awesome! Thanks for the help, it's just student work but pass on your contact info - never know when a job might pop up that requires someone with your skills! It's 2am here will open the file & let you know how I go tomorrow. Cheers
 
  10 October 2012
Just PM me if you need _real_ help.

Cheers, mate

/Risto
__________________
- Oh no, it's me -
 
  10 October 2012
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 10:31 PM.


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