Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Left-right movement, and spline follow
#1
I am trying to make a racing like game, where the character follows a path, and the player controls left and right movement only, as well as jumping. The track has intersections and forks, so you can choose to go left, right, or forwards (or up) depending on your position on the current path.  

So far, the volume controller seems the right choice for the left right movement. However, I can't find a way to implement the follow behaviour the spline controller has, to switch splines. And when using spline controller, the character moves back to the center after applying lateral offset.  

Right now, I am using a combination of the volume controller, and a script with a reference to the spline it's currently on. I use LastVisibleControlPoint to check when the character reaches the end of the spline, and add left/right/forward/up spline references on that last control point to decide where to go based on position.  

I just started using Curvy Splines a couple of days ago, so I'm probably missing something obvious. I feel like there's a better way of doing this, lateral movement and spline follow based on that lateral offset.
Reply
#2
Hi,
I would use spline controllers in this case, since they allow to use connections. Please refer to the documentation related to the controller's "Connection handling" section to learn more about defining custom behaviour when reaching a connection.
I would use lateral offset to make your object move laterally. Can you explain more what your issue is with the Offset settings?
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#3
Hi,

Thank you for the reply! My bad, I seem to have misunderstood something regarding the offset radius. I am now using a spline controller, with the offset radius for lateral movement, and custom connection handling for the different paths, and all works well.

Now I am wondering if there is a way to limit lateral movement based on track width, similar to how it works for the volume controller. With the volume controller, if I scale the shape extrusion to start at x width, and then it ends at x/2 width, lateral movement will always be clamped correctly between the edges of this shape. Is it possible to create the track with volumes still, and get the scaled width and use it to limit the offset radius in the spline controller similarily?
Reply
#4
Hi
Yes it is possible. Create a script that will read the scale value from the generator's module, and modify the lateral movement setting in the controller accordingly.
You can get the variable scaling from a BuildShapeExtrusion by reading the ScaleMultiplierX/ScaleMultiplierY properties.
https://api.curvyeditor.com/FluffyUnderware.Curvy.Generator.Modules.ScalingModule.html#FluffyUnderware_Curvy_Generator_Modules_ScalingModule_ScaleMultiplierX
I wish this helped.
If and when you feel like it, please leave a review for the asset, that helps a lot.
Have a nice day
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Nested Spline Volume Spot Instantiation merobbins5 3 7 07-26-2024, 09:58 AM
Last Post: _Aka_
  How to start volume spots at the end of spline instead of front j95677 1 5 07-07-2024, 04:58 AM
Last Post: _Aka_
Question VolumeController CrossRelativePosition Very Choppy Movement pako88 5 10 06-07-2024, 03:43 PM
Last Post: _Aka_
  How to get length starting from one spline to connected nth spline Dragon-3623 1 4 05-14-2024, 04:52 PM
Last Post: _Aka_

Forum Jump: