ASP scripted physics simulation - bouncing ball with gravity

Want to share your Moho work? Post it here.

Moderators: Víctor Paredes, Belgarath, slowtiger

User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

ASP scripted physics simulation - bouncing ball with gravity

Post 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
User avatar
Banterfield
Posts: 138
Joined: Tue Aug 03, 2004 10:40 pm
Location: Colorado

Post 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!
Dave
User avatar
funksmaname
Posts: 3174
Joined: Tue May 29, 2007 11:31 am
Location: New Zealand

Post by funksmaname »

excellent dude! keep on with this one, woudl be cool to create hair bones with real gravity and stuff! :)

you da man.
User avatar
AmigaMan
Posts: 1017
Joined: Thu Sep 14, 2006 3:40 pm
Location: UK
Contact:

Post by AmigaMan »

But...but...how!!? Brilliant! :shock:
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post 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
F.M.
Posts: 497
Joined: Thu Nov 04, 2004 4:29 pm
Location: Between my ears

Post by F.M. »

Can the script be modified, in order to use it with particles instead of bones?
"and then Man created god!"
User avatar
Banterfield
Posts: 138
Joined: Tue Aug 03, 2004 10:40 pm
Location: Colorado

Post 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.
Dave
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

Anything that a bone "controls" will be controlled by this script.

Even layers that are bound to bones including particle layers.

-vern
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post 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
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post 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
User avatar
Banterfield
Posts: 138
Joined: Tue Aug 03, 2004 10:40 pm
Location: Colorado

Post 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.
Last edited by Banterfield on Sat Sep 22, 2007 12:07 am, edited 1 time in total.
Dave
User avatar
Banterfield
Posts: 138
Joined: Tue Aug 03, 2004 10:40 pm
Location: Colorado

Post 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?
Dave
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post 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
User avatar
Banterfield
Posts: 138
Joined: Tue Aug 03, 2004 10:40 pm
Location: Colorado

Post 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
Dave
Post Reply