Using Beams to simulate projectile curves

Hi, and thanks for reading in advance.

I’m attempting to create an arc-of-travel visual effect for players using the Worker class in my game, which is able to lob bombs a large distance away from itself. By holding the proper button, the player will charge up their throw and increase the distance the bomb will travel. Upon releasing, the bomb will automatically assume the minimum speed and travel arc necessary to land upon the chosen spot. I’m not exactly familiar enough with ballistics to know how to mathematically arrive at those numbers, but I figure with enough reading + trial and error I should have something functional working soon.

The issue arrives in creating a visual that represents the bomb’s arc of travel to the chosen destination. I can create and reposition a landing spot marker easily enough, but each update tick I assume I’ll need to calculate the minimum throwing angle and initial velocity and then create my visual based on that information. Rather than going through the hassle of creating a table of points along the travel path, I decided to attempt to use the Beam object - it’s simple, stylistic, and even has an implemented curving feature that uses studs as an offset.

Problem is, they use a bezier-curve method utilizing four values, two of which I have to set manually. I have no idea how I’d go about re-creating a travel arc using this system - I would assume one value would be the maximum height of the arc? There are two, and they can’t be repositioned along the length of the beam, so the values obviously have some correspondence in a ballistics formula. Has anyone tried this before? Does anyone have advice on where I might start, or how I can use a bezier curve to mimic the travel arc of the bomb?

Thanks for your time.

Here’s a link that was posted on an earlier topic regarding projectile motion. There happens to be a section explaining how to model the path with a Beam effect.

4 Likes