5 Replies Latest reply on Sep 7, 2006 11:34 AM by kglad

# Gravity inside oval Movie clip

Ill bet no one can answer this. I have an oval that drags. I want to place a ball INSIDE the oval that will react with gravity and the movment of the oval. Like a superball inside a balloon, only 2D. Can you do this simply by somehow attaching a movie clip to the below code? I searched everywhere for an example or tutorial.
• ###### 1. Re: Gravity inside oval Movie clip
it's doable if the oval is an ellipse.
how?
• ###### 3. Re: Gravity inside oval Movie clip
the equation for an ellipse can be represented a parametric equation:

x = a *Math.cos(t);
y = b *Math.sin(t);

where a and b are the lengths of the major and minor axes and the slope of the ellipse at point x,y is given by m:

m= - b*b*x/(a*a*y);

that's all the data you need to use from your oval. from there it's just a matter of grinding out the path that your ball will travel using some elementary physics.
• ###### 4. Re: Gravity inside oval Movie clip
Wow, thanks! I will love trying this when I have time!
• ###### 5. Re: Gravity inside oval Movie clip
you're welcome.