Page 1 of 2

ASP scripted physics simulation - bouncing ball with gravity

Posted: Fri Sep 21, 2007 4:03 pm
by heyvern
I understand that you need the pro version to use the scripting feature but I just have to share my latest discovery!!!!

I am so freaking excited about the possibilities!

This proof of concept animation has no key frames. It is entirely controlled by a script:
http://www.lowrestv.com/moho_stuff/scripts/gravity2.mov

I will be documenting my progress and posting files and samples in this thread if you are interested:

viewtopic.php?t=9488

Believe it or not adding in collision detection with other bones should be very simple. I plan to add in some sort of bone controls for changing gravity and bounce and for having multiple bones with different values.

My next test will be to add additional bones to simulate squash and stretch.

I'm freaking out!

-vern

Posted: Fri Sep 21, 2007 5:24 pm
by Banterfield
Wow, Vern, that is amazing. I think you should change your name from "heyvern" to "vernistheman". You keep blowing my mind. Don't stop!

Posted: Fri Sep 21, 2007 6:09 pm
by funksmaname
excellent dude! keep on with this one, woudl be cool to create hair bones with real gravity and stuff! :)

you da man.

Posted: Fri Sep 21, 2007 6:10 pm
by AmigaMan
But...but...how!!? Brilliant! :shock:

Posted: Fri Sep 21, 2007 6:47 pm
by heyvern
Check the first post in the other script thread for the newest update.

Now you can add your own bones all on one layer. Have as many bones as you want and they all fall and bounce around.

It's a bit of a "one trick pony" at the moment but it is so easy to add in new features it will get better pretty quickly.

I have a new idea! I plan to have the script look for the last key frame of a "gravity bone" before starting the simulation.

So, a character could be holding an object and walk around with it then just throw it. Have a key frame on that last spot and it will use the simulation. The simulation would be based on the last location of the bone rather than the frame 0 location. This thing ROCKS!

-vern

Posted: Fri Sep 21, 2007 9:16 pm
by F.M.
Can the script be modified, in order to use it with particles instead of bones?

Posted: Fri Sep 21, 2007 9:22 pm
by Banterfield
I was wondering if you could just drop a ball object with the script inside a particle generator, and what would happen.

Also, wondered what would happen if you allowed (or implemented) it to move along the z axis.

Posted: Fri Sep 21, 2007 11:05 pm
by heyvern
Anything that a bone "controls" will be controlled by this script.

Even layers that are bound to bones including particle layers.

-vern

Posted: Fri Sep 21, 2007 11:07 pm
by heyvern
Banterfield wrote:Also, wondered what would happen if you allowed (or implemented) it to move along the z axis.
.... uh... what? What exactly moves on the z axis? Bones can't move on the z axis... so no... can't be done.

;)

edit:

You could scale the mesh or move the vector layer to create z axis movement. Could be pretty convincing if done right.

-vern

Posted: Fri Sep 21, 2007 11:12 pm
by heyvern

Posted: Fri Sep 21, 2007 11:17 pm
by heyvern
For some reason a bone layer inside a particle layer isn't effected by the script... have to work out why exactly. That would be kind of cool if it worked.

-vern

Posted: Fri Sep 21, 2007 11:45 pm
by Banterfield
heyvern wrote: edit:

You could scale the mesh or move the vector layer to create z axis movement. Could be pretty convincing if done right.

-vern
What about the layer attached to the bone? :) I'm in Ubuntu right now, or I'd just try it myself sans question.

edit - I suppose it doesn't matter if is scaling or being shifted on the z buffer so long as it can be controlled in a mathematically appropriate way by your script.

Posted: Sat Sep 22, 2007 12:06 am
by Banterfield
heyvern wrote: .... uh... what? What exactly moves on the z axis? Bones can't move on the z axis... so no... can't be done.
Vern, are you sure that isn't because you have 3d camera turned off? I just tried it (changing z value of the bone layer) and it worked - I rotated the workspace to make sure I wasn't being a muttonhead. Not individual bones, mind, but the bone layer.

Perhaps you meant individual bones?

Posted: Sat Sep 22, 2007 1:19 am
by heyvern
Yes the bone layer can move on the z axis... but not the bones.

Adding a z axis to this script would be an absolute and total nightmare. Not even going to try that. Too much math, too many variables to keep track of. Can you imagine? Random bouncing and collision detection in 3D? Yikes... my head hurts just thinking about it.

If anyone else wants to fiddle with the script be my guest.

;)

-vern

Posted: Sat Sep 22, 2007 1:58 am
by Banterfield
heyvern wrote: Adding a z axis to this script would be an absolute and total nightmare. Not even going to try that.
That's cool. Just thought I'd ask if it were possible.

Thanks again for your scripting explorations, Vern. This is really an amazing thing you're putting together. :D