Point to point system readme:

This is the point 2 point minecart system readme, here i'll go step through step on how to set up your scenes!

 

Important Notes*

-Create a tag called "Anchor"

-Create an empty game object called "ObjectMount"

-Create an empty game object, name it whatever you wish, but use this to hold you points!

 

STEP 1:

Set up your  scene. Use modular tracks provided, vertex snapping ("V") works well with matching up objects together perfectly.

 

To set up the points, create and empty game object and place a gizmo to see it easier. For this tutorial i used cubes to see my points easier!

 

Take a look at the picture (left) i have a track set up with two points, first one closest to minecart will be the "starting" point, second one will be its next destination. 

 

If your hierarchy is set to alphabetical, make sure to name your "cubes" or "empties" something like this, to keep them in order: "point (0), point (1), point (2)," etc.

If its set to list, then just make sure you drag and drop each point in order that you want them to be!

 

For corners, set each point where the minecart would realistically turn. If playing third person, and having AI running the minecart, place more points on you turns for a more realistic look. If you are riding it, place less, as it will still work accordingly!

 

For going up and down ramps, it works the same: just place one point at bottom of ramp and one at the top!

 

*NOTE*

for best results, place each point about 1 foot above the tracks.

 

-Not only is this a great way to travel convieniently through caves, but this point2point system also can be looped for enless fun! just check the "loop" box to keep it going, round and round!

 

 

After setting up your track and all of your points. You're ready to add the scripts, and a few more essentials.

Create an empty Game Object and name it "ObjectMount" (exactly as shown without quotations). Center your ObjectMount inside of the Mine Cart, and place it roughly about 1-2 feet above the model. This is where the camera posistion will be when riding it!

 

Make sure to drag and drop in the hierarchy as a child of the Mine Cart as shown in screenshot. The mine cart must be the parent for this to work.

 

Also create a new Tag and name it "Anchor"  then tag the Mine Cart with the Anchor tag.

 

Next: Insert "PathFollow" Script onto your Mine Cart, it will look like the screenshot (left).

Player: Your controller that will be riding it. (first person controller, etc..)

Targets Container: This is the Empty Game Object carrying all of the track Points. (explained below)

Current Target: This reads which target Point the mine cart will be heading to next.

Speed: Speed to travel.

Dampening: How fast or slow the Mine cart will turn on the tracks.

Moving: Will check if the minecart is moving or not. Can be activated before pressing play, if you want AI to run it instead of your controller.

Occupied: Will check if you or another controller is riding it.

Direction: A direction between 1 or 2 

1 means its going foward down the list of points to the end, 2 means its going back the other way.

 

Make sure to create another empty game object, name it whatever you want, and place every Point as a child to this object. Make this empty, the parent to every point in your scene, and keep the points in order in the list that the Cart will travel on them. Mine looks like this (left).

 

Once created, drag and drop the empty into PathFollow script, where it says Targets Container.

 

Make sure to set your speed and dampening: I prefer using 8 speed and around 2 dampening when riding it.

If you're using the FPS controller, insert that or any other controller into the Player slot in the PathFollow script.

 

All thats left is to attach just a few more things:

Take your FPS Controller and attach the "Player" Script to it. Take the Camera, or in this case the "FirstPersonCharacter" and attach it to the Player Camera slot. Lastly Attach the Mine Cart to the Object Mounted To slot.

This scripts also has a dampening effect which allows both your cart and camera to have beter control over the dampening of turns.

 

Last of all, press play! Walk up to your Mine Cart and press the "E" key to start riding! Note: once you take the ride your stuck until it ends! Enjoy!

 

-Aquarius Max