Game Development Community

Generating Bezier Points

by Robert Fritzen · in Torque 3D Professional · 04/21/2014 (12:00 pm) · 0 replies

Alright Folks, I've got something nice and complex to work out today, and you know what that means! Time to ask the people who likely know more about the topic than I do, lol...

Anyways, what I've got going on here is my current project. I'm trying to re-create the old ELF projectile from Tribes 2, and doing so, requires the ability for the projectile to form an arc between the gun and the target. I've worked out everything else, except the part where you generate the points from which the arc forms.

How I'm doing this currently, is there's a field in the datablock (like T2) where the user can specify the # of control points, and the projectile will generate those control points along a arcing (Quadratic) path between the muzzle and the target, stored in a Vector<Point3F> and then rendered in a future step using line segments to construct the beam.

What I'm having an issue with here, is the actual process of generating those control points, and after reading endless amounts of articles online about generating Bezier curve points, I'm completely lost as how to do this, especially since they're using functioning in which the points are apparently "known", my problem being, if you knew the points, I wouldn't be here in the first place.

Anyways, my question for today is to find out the easiest way to construct a list of 'n' bezier points along a path between a starting point (muzzle point), and the target point.

EDIT: *Solved* Used an edited form of the function presented here