Hello!
I am creating a 2D game and I have a “player-shpere” in it. My sphere above the surface (coordinates x = 0, y = 0, z = -1).
[33323-безымянный.png|33323]
[33324-безымянный.png|33324]
And I have a player controller:
void Update()
{
float verticalSpeed = Input.GetAxis("Vertical") * speed;
verticalSpeed *= Time.deltaTime;
float horizontalSpeed = Input.GetAxis("Horizontal") * speed;
horizontalSpeed *= Time.deltaTime;
this.transform.Translate(horizontalSpeed, verticalSpeed, 0);
}
It works fine, but I want my sphere to roll in movig direction (like a real boll is rolling in it’s direction). The sphere just have to rotate according “controller” directoin.
What should I do?