Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Handling Connections with FollowSpline and Path Switching
#1
I have a couple of questions regarding how to handle connected splines with the FollowSpline script and switching between splines. 

My current prototype scene is setup as shown in the image below. There are two splines, the straight path and looping sub path, with these being connected through the last control point of the looped path and the 5th control point of the straight path. I then have an empty game object with the FollowSpline script attached to which my player object is parented. With the player object able to move freely in the X and Y axes.

[Image: Unity_Curvy_Question.jpg]

My questions relate to the game logic I am implementing to handle the player switching between the two paths in the scene.

Firstly I have a box collider (marked by the purple quad in my prototype scene)  which when the player model (with a rigidbody attached) collides with my player control script finds the spline that has the tag associated with the looped path and then tells the FollowSpline script to make this the spline to follow. This works relatively well, although the switch is rather sharp and I was wondering if there was a way to smooth/ease the switch so that it occurred more smoothly i.e. tell the FollowSpline script to slowly switch the spline paths?

Secondly, I was wondering if there was a way to have the FollowSpline script handle connections? I tried using the legacy SplineWalkerCon script which handled the connections fine but when it came to the switching, my player model would start on the looped path at the 5th or 6th control point rather than the first, which is obviously not ideal.

Any suggestions/advice would be appreciated.

Also thanks for the new SplineShape feature, it makes generating loops and spirals so much easier than having to roll my own code to generate them or build them by hand.

 
Reply


Messages In This Thread
Handling Connections with FollowSpline and Path Switching - by Yog-Shoggoth - 05-20-2014, 09:06 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Connections Problem Juton 3 14 03-06-2024, 10:41 AM
Last Post: _Aka_
Wink Train carriage with 2 bogies following a path arcadeperfect 9 27 08-25-2023, 02:56 PM
Last Post: arcadeperfect
  Are connections pooled? Lupos 1 3 05-09-2023, 09:18 AM
Last Post: _Aka_
  Generator does not exactly follow the path F.A.L. 3 4 04-24-2023, 03:49 PM
Last Post: _Aka_

Forum Jump: