SimplyMaya Forums

Welcome to the forum, feel free to ask questions here.

Home / forum / Animation / Mel Scripts & Programming / expression for oscilating movement
Register FAQ Members List Calendar Mark Forums Read

New Thread
 
Thread Tools
Old 04-02-2004, 12:43 AM   #1
danrocha
Subscriber
 
danrocha's Avatar
 
Join Date: May 2003
Location: Campinas - SP - Brazil
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy expression for oscilating movement

Hello

I need an expression to make a ball go up and when it reaches a certain height, it kinda oscillates, as with those popping toy clowns coming out of boxes attached to a spring...

I have tried several approaches but can't get this to work!


I'll try to explain it more clearly: I have a ball. I want it to go UP (y axis only) in a accelerated movement, which begins really fast (like an explosion) and slows down abruptely at the end
(as if it was attached to a spring); then it goes down a little, then up again, down again, etc, with its speed going down until it stops (or keeps oscillating real slowly)....

Maybe it is too complicated, and I should try another way to do this?

Please heeeeelp
thanx a lot
Daniel
__________________
<font size="1"><strong>"The hardest thing to see is what is in front of your eyes"
<em>Goethe</em></strong></font>
danrocha is offline   Reply With Quote
Old 04-02-2004, 02:15 AM   #2
kbrown
Moderator
 
kbrown's Avatar
 
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
Thanks: 0
Thanked 8 Times in 8 Posts
Default

Keyframing gives you the best control. You could do it with an expression too but is it really worth it?

Here's one possibility:
Code:
int $iStartOsc = 6;
float $fHeightMult = 3;
int $iStopFrame = 75;

if(frame < $iStartOsc)
	nurbsSphere1.translateY = frame * $fHeightMult;
else
	if(frame < $iStopFrame)
		nurbsSphere1.translateY += $fHeightMult * sin(frame - $iStartOsc) * (($iStopFrame - frame) / $iStopFrame);
__________________
Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!
kbrown is offline   Reply With Quote
Old 04-02-2004, 02:21 AM   #3
mtmckinley
The Maya Mountain
 
mtmckinley's Avatar
 
Join Date: Aug 2002
Location: Seattle, WA
Posts: 8,245
Thanks: 1
Thanked 25 Times in 25 Posts
Default

you might could use a dynamic constraint with some gravity and initial movement and such. Check out the Dynamic Constraints tutorial we've got here for more info.
__________________
-Mike
www.mtmckinley.net
The Maya Toolbelt
mtmckinley is offline   Reply With Quote
Old 04-02-2004, 10:07 AM   #4
danrocha
Subscriber
 
danrocha's Avatar
 
Join Date: May 2003
Location: Campinas - SP - Brazil
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Thumbs up

Thanx a lot...

I've tried then to use a spring constraint, played around with its damping and stiffness attributes, and got pretty much the movement I needed.

As I need lots of balls doing exactly the same movement, I'll try to duplicate them and to use diferent keys to control the activation of the constraint.

I'll try to implement the code, anyway. See what works best

Daniel
__________________
<font size="1"><strong>"The hardest thing to see is what is in front of your eyes"
<em>Goethe</em></strong></font>
danrocha is offline   Reply With Quote
New Thread

« Previous Thread | Next Thread »

Thread Tools

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

1 Month

$34

Month-to-month billing
$34/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
 
 

3 months

$87

Billing every 3 months
$29/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
Save $5 per month or $15 in total compared to monthly billing with this package.

12 months

$288

Billing every 12 months
$24/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
Save $10 per month or $120 in total compared to monthly billing with this package.

Your plan will automatically renew. You can cancel at any time via your PayPal account to avoid being charged again.

You can view the FAQ on our video plans here. You can contact us directly here. By clicking one of the buttons above, you agree to our Terms and Privacy Policy.