Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

How would i create a non linear 3d side scroller?

Discussion in 'Editor & General Support' started by Glowball123, Apr 9, 2018.

  1. Glowball123

    Glowball123

    Joined:
    Mar 10, 2016
    Posts:
    78
    i have been trying to find tutorials on how to make a 3d side scrolling game using a circular path, similar to the whispy woods boss in kirby 64. Although wherever i looked all i could only find tutorials on linear 3d side scrollers, i would appreciate any knowledge on how i could achieve this, maybe a link to a tutorial if there is one.
    upload_2018-4-8_21-23-38.png
     
  2. Glowball123

    Glowball123

    Joined:
    Mar 10, 2016
    Posts:
    78
    bump someone respond please
     
  3. Good_Venson

    Good_Venson

    Joined:
    Oct 12, 2014
    Posts:
    22
    Well, my first thought would be to use splines or bezier curves to create the circular path. There are several free spline solutions on the asset store. A simple spline follower script would take care of any moving objects that need to move around the circle. One of the advantages of this solution is that you could make non-circular paths just as well.

    A second, and perhaps simpler solution for if you only wanted a circular path, would be to use
    transform.RotateAround(pivot, Vector3.up, DegreesToRotate)

    ...where DegreesToRotate would be
    (the actual distance you want to move) / ((Mathf.Pi * Vector3.Distance(transform.position, pivot)) / 180)

    ...instead of setting the x and z position of the transform directly.