Math for VSFX

Updated on March 1  2024

also Houdini Resources


 Overview (pictoral)


copyright © Deborah R. Fowler



Shooting Ball

Deborah R. Fowler



Shooting Ball

Updated on June 22  2013


In Houdini, there are a number of ways to fire a ball from one point, fly into the air, and have it land at a given point.

One solution would be to use a path curve, however the problem with the path follow is we cannot easily extract the point information out to get the values we want to manipulate. Path follow is usually intended to keyframe the position and that is not as procedural as one might like. To mimic realism we really are going along the distance in x in uniform steps (time), but we are traveling along the curve non-uniformly.

The first method is to use a ray sop and a user defined curve.
The ray sop is a really quick way to get this information without doing a bunch of curve analysis. A drawn curve (just like you would use with the path follow) is used, however now you project the uniform points of units of time (ie. frames) onto the curve. This then gives you an accurate version of where the ball should be in space. You can vary the framesPerCycle (less frames, the faster it goes). This way you are guaranteed to hit the start and end and you can visually adjust the path.


The second method is a simplified mathematical relationship
. The arc of the ball depends on the initial velocity. This way is more mathematical (simplified of course - ignoring friction etc). The arc of the curve that it follows will be dependent on the startingYvelocity. This is much the way a ball would fly into the air. I'm using distance, starting velocity in the y direction (which at the top the change in y will be zero, and then decrease), and framesPerCycle. Again framesPerCycle will control the speed.

The second method is based on the fact that the change in x, that is to say, dx = distance / frames and we can integrate over this to find the value at a given frame.
The change in y, that is to say,  dy = startYvelocity - frame * (2 * startYvelocity)/frames
If you take the integrals to find x and y you will get the formula for x and y at a given frame assuming it is "frames" long.
x (frame) = distance/frames * frame
y (frame) = startingYvelocity * (frame - (frame * frame)/frames)

These are both available in the hip file here. Please read the explanations linked below for more details.

The first method using a ray sop and a user defined curve is described here.
The second method in which the arc of the ball depends on the initial velocity, is a simplified mathematical relationship described here.