Parabolic Shot

From Synfig Studio :: Documentation
Revision as of 18:08, 16 December 2007 by Genete (Talk | contribs)

Jump to: navigation, search
Languages Language: 

English • español


This is an small tutorial to show how make an object to follow a path given by a mathematical function as a reply for a requested tutorial.

Mathematical function to follow

We're going to simulate a cannon shot. A cannon bullet describes a parabolic trajectory after it is shot by the cannon.

Parabolic-shot.gif

The mathematical equations that govern the trajectory are:

X=V0x*t+X0
Y=-0.5*G*t²+V0y*t+Y0

where:

t = the current time for the mathematical equation
X = the 'x' coordinate of the bullet at a time 't'
Y = the 'y' coordinate of the bullet at a time 't'
X0 = the 'x' position of the bullet at time t = 0
Y0 = the 'y' position of the bullet at time t = 0
V0x = the 'x' component of the velocity when shot (t = 0)
V0y = the 'y' component of the velocity when shot (t = 0)
G = the gravity's acceleration.

You usually have the angle and the velocity modulus instead of its components. The decomposition is quite easy:

V0x = V0*cos(phi)
V0y = V0*sin(phi)

where:

V0 = the velocity when shot (t = 0)
phi = the shooting angle.

Discomposing the functions


Languages Language: 

English • español