Simply Maya User Community

Simply Maya User Community (https://simplymaya.com/forum/index.php)
-   Programming (https://simplymaya.com/forum/forumdisplay.php?f=32)
-   -   createDynChain - MEL for creating semi-dynamic chains (https://simplymaya.com/forum/showthread.php?t=4526)

kbrown 11-03-2003 05:54 PM

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 ;)

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

1. http://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. http://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: http://www.simplymaya.com/download_p...id=29&type=mel)

kbrown 11-03-2003 06:12 PM

Forgot to mention that this is not a script to take coding examples from :). 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 :D

adldesigner 11-03-2003 06:46 PM

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.

kbrown 11-03-2003 07:57 PM

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...

kbrown 12-03-2003 03:46 PM

Hmm... 2 downloads... Was this a waste of time? :)

adldesigner 12-03-2003 04:21 PM

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)>

kbrown 20-03-2003 08:00 PM

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: http://www.simplymaya.com/download_p...id=29&type=mel)

Alan 16-04-2003 01:36 PM

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! :)

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

kbrown 17-04-2003 07:30 AM

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 :)

kbrown 30-05-2003 08:52 PM

Updated to 0.4a. It's an alpha because I'm not sure if the new feature is usable or not...

Here you go:
http://www.simplymaya.com/download_p...id=29&type=mel

Hugh 03-06-2003 09:23 AM

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:
http://www.unframedstudios.com/maya/ears.avi (650k DivX)
http://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:
http://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!

kbrown 03-06-2003 11:32 AM

Nice, I'll have a look later today when I get home.

Thanks!

kbrown 03-06-2003 10:09 PM

I tested your script Hugh and it worked like charm. Interesting setup it generates. Care to explain it a bit?

Hugh 04-06-2003 12:29 AM

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....

kbrown 04-06-2003 06:34 AM

What can I say... Cool :)


All times are GMT. The time now is 04:08 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Simply Maya 2018