U
U
Uncle Bogdan2021-06-14 11:07:00
Unity
Uncle Bogdan, 2021-06-14 11:07:00

How can you implement movement along the walls of the tunnel in a normal way?

Like now I did this, but it all depends on the dummy on which the character is. I turn it, the character turns. The problem is that if the tunnel turns, the character will fly out of it. And in general, it's somehow very difficult, you need to put the dummy in the middle of the tunnel, and the player on the surface of the tunnel.

Video

Hierarchy:
60c70d87c7593367823547.png

The code is on the Player object:

The code
void FixedUpdate ()
  {
    transform.position += transform.right * Time.fixedDeltaTime * force;

    Vector3 acceleration = Input.acceleration;

      transform.Rotate(new Vector3(acceleration.x * sidewaysForce * Time.fixedDeltaTime,0,0));

  }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question