Search Unity

Resolved SnakeMovement in Unity

Discussion in 'Scripting' started by ookk47oo, May 27, 2022.

  1. ookk47oo

    ookk47oo

    Joined:
    Mar 17, 2017
    Posts:
    80
    I have searched a lot for the implementation and I found these below.



    Snake tail follow

    Another Snake follow solution

    They are very helpful, but I think there are still some defects in these solutions.

    Defect 1. All of the create-body 's scripts in these solutions used a delay time to keep a fixed gap between bodies.
    What if the snake's speed is various, which leads to different gaps between body parts?

    Defect 2. How could I insert a body to the snake or swap a body with another and makes the snake apply the change automatically?
    ( all of these solutions are simply appending a body to the tail, which will also cause same problem in defect 1 if the snake speed has changed).

    How could I make up for deficiencies?
     
  2. ookk47oo

    ookk47oo

    Joined:
    Mar 17, 2017
    Posts:
    80
    Solution is here.