Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Curvy 2.5D Platformer - Detaching from Spline when Jumping
#1
Question 
I'm currently hacking about/toying with making a 2.5D platformer using curvy splines to create the path for the player to follow.

So far I've put together a control system that moves the player horizontally on the spline and uses a modified version of the Endless Runner example to allow the player to jump and connect to new splines if there is one above them or if they fall off one spline path onto another.

However I'm stumbling on how to set the controller up so that the player can jump from one end of a spline onto another i.e. across a horizontal gap between two separate splines. At the moment my control system stops the player at the end of the spline and doesn't allow the jump to continue beyond the last control point. My current idea is to have the player object break it's connection to the spline it has just been on while somehow continuing to move in the direction of the jump and searching for a new spline below the player object to attach to.

I was just wondering if anyone had a better idea or suggestion on how to implement a system for handling jumping between splines or had an implementation that they could share.
 

 
Reply
#2
Your idea sounds good. If you know the next spline, you could store that information at the last CP GameObject and let your controller do a quick range-check against the new spline's starting CP. Then, when over the new spline, "hook" the controller back onto track.

 
Reply
#3
Having worked on my idea of modifying the Endless runner script to enable me to detach at the end of splines, I abandonded that approach as it wasn't performing as I wanted and the code was becoming convoluted.

So I went back to basics and cretaed a new rigibody based approach which allowed me to have a player object following splines as a guide/rail while under the control of the Unity physics system and thus able to jump and disconnect/reconnect to the spline paths at will.

However I'm encountering an odd issue when I try to have the player object follow a sloped curve i.e. a curvy spline where the control points curve up or down in the Y axis, the rigidbody/player follows the curve of the spline fine but it is dragged towards the first control point without any user input. And if you try to move away from the first control point, it feels as if the rigidbody is connected by a rubber band to that control point, in other words you can only move so far before the rigidbody slows and struggles to move any furhter away from the first control point.

If I disable the curvy spline components being used as a guide/rail under slope, then the rigidbody behaves as expected i.e. it can freely move along the curved surface. I therefore suspect that my issue is arising from how I am setting the position of the rigidbody on the slope using the curvy spline guide. At present, the rigidbody script adopts the approach of the endless runner script and casts a ray downwards to detect a collider attached the the curvy spline. It then uses the InterpolateFast method to get the X and Z position for the the current TF of the spline and applies these to the rigidbody, with the Y position taken from the rigidbody to enable it to stay on the surface of the slope.

However I'm at a loss as to where I'm going wrong so any advice/suggestions would be appreciated.
 

 
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Curvy 7.1.1 is live _Aka_ 2 111 09-04-2020, 08:09 AM
Last Post: _Aka_
  Generated mesh using bezier spline is not following the path accurately processor 3 144 08-25-2020, 04:39 PM
Last Post: _Aka_
  Best practice when Instantiating game object with spline GenericJoe 1 145 08-22-2020, 02:40 PM
Last Post: _Aka_
  road crossings like T-Crossing or X-Crossing with Curvy? Econt 1 148 08-13-2020, 01:07 PM
Last Post: _Aka_

Forum Jump: