Integrating 3D models with photography
Interested in integrating your 3D work with the real world? This might help
# 1 11-03-2003 , 05:54 PM
kbrown's Avatar
Moderator
Join Date: Sep 2002
Location: London, UK
Posts: 3,198

createDynChain - MEL for creating semi-dynamic chains

Hello fellow MELlons :p

I started working on this mel script since I needed some long chains with many chain links on my Andrea Gail project. Regular dynamics were out of the question because they would have slowed down my work pretty badly.

The script has been coming along pretty nicely and I though I'd post it here for beta testing. Be aware that I've been working on this only for few days so it may contain some fundamental bugs user added image

Here are some results I've got with the script:

1. https://kotisivu.mtv3.fi/karppa/temp/dynChain3.avi (600kB, divx)
- The backmost chain is a direct result of the script.
- The chain in the middle has only one modification done to it: turned the last "control cube" from passive rigid body to active.
- The frontmost chain is like the backmost but the last control cube has been hand-animated.

2. https://kotisivu.mtv3.fi/karppa/temp/dynChain4.avi (586kB, divx)
- This is a classic child swing. I created two chains, turned their end control cubes into active rigid bodies and hinge constrained the poly cube to them. I encountered one problem with the script while doing this: The script creates a gravity field for each chain. This really isn't necessary and I'll propably change this in future releases.

Anyway, here's the script. Open it up in a text editor, the documentation is there. Please read it through before asking questions.

Comments, bugs, critique, suggestions, anything is more than welcome...

(Attachment removed. Newer version can be found here: https://www.simplymaya.com/download_p...id=29&type=mel)


Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!

Last edited by kbrown; 03-06-2003 at 10:13 PM.
# 2 11-03-2003 , 06:12 PM
kbrown's Avatar
Moderator
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
Forgot to mention that this is not a script to take coding examples from user added image. I still need to read the mel book i received yesterday. Many things are still unclear to me so I guess this is sort of a spaghetti-code-hack :p But it works user added image


Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!
# 3 11-03-2003 , 06:46 PM
adldesigner's Avatar
Registered User
Join Date: Sep 2002
Location: CCS, Venezuela
Posts: 3,363
Hehehe K-man, this is the part in which I fall apart. I know logic, but I´ve never been able to "unscramble" computer code. I´ll leave that for you guys.

# 4 11-03-2003 , 07:57 PM
kbrown's Avatar
Moderator
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
Hehe, thanks adl... I guess... :p

Anyway, I opened a page for this script on my site so you can find updates in one place and it's easier for me to maintain too...

Link in signature...


Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!
# 5 12-03-2003 , 03:46 PM
kbrown's Avatar
Moderator
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
Hmm... 2 downloads... Was this a waste of time? user added image


Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!
# 6 12-03-2003 , 04:21 PM
adldesigner's Avatar
Registered User
Join Date: Sep 2002
Location: CCS, Venezuela
Posts: 3,363
I wouldn´t think so K-Man. Recognition doens´t come as fast as someone would expect ... but eventually it does. However if it does what it does as stated then it´s one hell of a script. <adldesigner resists the urge to reinstall Maya and try it out, goes for a beer in the kitchen instead>

<Holy sh*t! (after seeing the DIVX movies)>

# 7 20-03-2003 , 08:00 PM
kbrown's Avatar
Moderator
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
Lol... I forgot about this thread. I've updated the script (actually some time ago). Here's what I've done:

- Added a null (locator) for each chain with custom attribute connections to the essential chain behaviour attributes.
- A simple UI added
- No need to use straight curves any more
- Uses one gravity field for all chains created
- Added basic control on the amount of rings created per chain
- Added ability to use instanced chain rings (can be slower but uses less memory)

More info on my site and in the script file...

(Attachment removed. Newer version can be found here: https://www.simplymaya.com/download_p...id=29&type=mel)


Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!

Last edited by kbrown; 03-06-2003 at 10:12 PM.
# 8 16-04-2003 , 01:36 PM
Alan's Avatar
Moderator
Join Date: Oct 2002
Location: London, UK
Posts: 2,800
It's definatley not a waste of time to post this!! It's nice to have a fellow techy!! I'm really getting into MEL scripting. It's good to not always see the same character modelling (not that there's anything wrong with that) etc etc that you always see in the WIP if you know what i mean! user added image

Check out the link in my sig to see the latest animation I am doing with MEL/C++


Technical Director - Framestore

Currently working on: Your Highness

IMDB
# 9 17-04-2003 , 07:30 AM
kbrown's Avatar
Moderator
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
Thanks for the kind words. I guess my script is for too specific use and thus hasn't been so popular. Anyway, it has served the purpose I designed it for. I uploaded the script to highend and from there it has been downloaded almost 250 times so I'm actually very happy user added image


Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!
# 10 30-05-2003 , 08:52 PM
kbrown's Avatar
Moderator
Join Date: Sep 2002
Location: London, UK
Posts: 3,198


Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!
# 11 03-06-2003 , 09:23 AM
Hugh's Avatar
Registered User
Join Date: Nov 2002
Location: Bristol, UK
Posts: 25
Cool - just downloaded it - will take a look this afternoon.....

When I first read it, I thought it was something similar to a script that I'm working on at the moment, but then realised that it does have it's differences...

If you're interested in seeing the results of my script, then take a look at:
https://www.unframedstudios.com/maya/ears.avi (650k DivX)
https://www.unframedstudios.com/maya/tailTest.avi (770k DivX)

It generates motion down the chain from the 'control joint' at the root. The initial idea was to do something that would automate a rabbit's ears - although I then realised that it would work well with tails as well.

If you want to have a play with an early beta of the script, you can download it from:
https://www.unframedstudios.com/maya/createEars.mel

Source the script, select the first joint that you want to be dynamic (there MUST be at least one parent joint) and run startCreateEar();

Have a play with the UI settings - the defaults are currently the ones that I found worked best for the ears....

There is still a lot of error checking missing, so please don't try to break it - you will find it very easy to do!


Hugh Macdonald

UnFramed Productions
Goodnight Opus - TD Lead

VFXTalk.com - Online Compositing Community - Admin
# 12 03-06-2003 , 11:32 AM
kbrown's Avatar
Moderator
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
Nice, I'll have a look later today when I get home.

Thanks!


Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!
# 13 03-06-2003 , 10:09 PM
kbrown's Avatar
Moderator
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
I tested your script Hugh and it worked like charm. Interesting setup it generates. Care to explain it a bit?


Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!
# 14 04-06-2003 , 12:29 AM
Hugh's Avatar
Registered User
Join Date: Nov 2002
Location: Bristol, UK
Posts: 25
Sure...

It all runs using dynamics - it creates IK handles for each joint, and then constrains these to active rigid bodies.

Each of these bodies is affected by gravity, but it's the 'attractor' field that does all of the work.

The attractor field is initially positioned in the same place as the IK Handle - but it is parented to two joints up the chain from the join that the IK handle is attatched to. This means that the joint with the IK handle is always trying to get back into a certain position relative to the joint above it.

The script doesn't actually use parenting like I've described - it creates other cubes which it point and orient constrains, and then parents to these - this was because the guy I originally wrote this script for couldn't change his joint hierarchy....


Hugh Macdonald

UnFramed Productions
Goodnight Opus - TD Lead

VFXTalk.com - Online Compositing Community - Admin
# 15 04-06-2003 , 06:34 AM
kbrown's Avatar
Moderator
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
What can I say... Cool user added image


Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!
Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads