Deborah R. Fowler



back

Shooting Ball

Updated on March 2   2013


In Houdini, here are a couple of ways to fire a ball from one point, fly into the air, and have it land in at a given point. These are both available in the hip file here.

The first method is to use a ray sop and a user defined curve. The arc of the ball depends on the initial velocity. Description here.
The second method is a simplified mathematical relationship described below:

Math behind shooting a ball with distance, frames and vertical velocity control



The diagram above shows equal increments in x, so if we use the frames as the total time, the change in x is:
Note that frames is the total number of frames and frame is the current frame.

dx = distance / frames

The change in y is equal to the y component of the starting velocity, call it vy, minus the current frame times (2 * vy) / frames. Written as:

dy = vy - frame * (2 * vy ) / frames


This makes sense since dy(0) = vy, dy(1/2 frames) = 0 at the top of the curve, and dy(frames) = -vy

x(frame) =
distance / frames * dframe

                = distance/frames * frame

y(frame) =
∫ (vy - frame * (2 * vy) / frames) * dframe

               = vy - frame - 1/2 frame^2 * 2 vy / frames
      
                 = vy - frame - frame^2 * vy/frames

                 = vy (frame - frame^2/frames)


This gives us the formulas for the current frame.



Where the parameters are: