Question by 
               dawickedeye · Aug 29, 2020 at 04:19 PM · 
                movementrigidbodyspline  
              
 
              Restraining movement to spline
Hey there. I'm working on a Sonic game based on modern sonic gameplay which mixes 3D and 2D gameplay. Most levels have 2D sections where Sonic's movement would be constrained to a spline like a side scroller. To achieve that so far, I look for the closest point on the spline and snap him to it so he stays centered. However, that is not a working solution! In the picture below, sonic, ( represented by the blue dot ) is supposed to stay at the level of the green line, however, that is not the closest point this he snaps to the pipe on the left. Same happens with figure 8 splines where there's will be at least 2 points at the exact same location.
Does anyone have an idea how to avoid that?
 
                 
                untitled.png 
                (406.7 kB) 
               
 
              
               Comment
              
 
               
              Your answer