Toasty Camera Rail System – Spline Groups

The spline and bezier curve scripts I am using are a modded version of the one shown in the “Curves And Splines” Catlike coding tutorial(Link here). As I refine this system I am making a specific variation of the bezier curve scripts to use for my camera rig, with my first major addition, shown here, the ability to split the spline into smaller segments.

toastyalpha_camerarig2groups_doc2

To do this I have added an additional array, a int array, that corresponds with each control point. This array is then used to identify which group that point is a part of when the script is implementing through the spline. Then if the next point’s group does not match up with the current points, the script knows it is at the end of a group.

Additional features on Spline Script

For the groups to be editable I needed to go through the existing bezier spline script and add in these additional functions, firstly to recognize and identify my new spline groups system, and secondary to implement them to the existing features of the current editor script before adding my own. Some of these were simple cases of directly recycling already existing equivalent functions and adapting them for group detection. The two substantial additions where the “GetGroupRange” and “GetPointWithinGroup” functions.

New Spline Walker

toastyalpha_doc

With the above additions to the spline script I could now make a new player tracker. This script recycles the same concepts as the older set up with some refinements. It functions by:

  • Getting the closest raw spline point to the script object’s current position.
  • Getting that points group, and then that group’s overall beginning and ending points.
  • It then loops through and calculates a set number of positions along the entire group’s curves and checks for the one nearest the script objects position.
  • Finally it returns a position and the progress along the groups spline that position is at as a float between 0 and 1.

With these values the camera rig and it’s look target can now place themselves on the appropriate point on their own splines.
As it is this set up seems to work without to much overhead, at some point I would like to try experiment with some alternative methods of find relative points on a spline to global positions, but for now, so long as it’s doesn’t hit performance I will be continuing with the current method.

Result

ToastyAlpha_CameraRig2Groups_Doc3.png

Above is a screenshot of a path made with just this addition to the camera rig. With it I have been able to make distinct directing choices, slow and fast transition(basic ease in and out effects) along the camera rail relative to the player’s position, and jump cuts all using the same splines and without the need of additional set ups.

Advertisements
Toasty Camera Rail System – Spline Groups

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s