Skip to main content

Indie game storeFree gamesFun gamesHorror games
AssetsComics
Bundles
Jobs
TagsGame Engines

Making a Character rotate.

A topic by RileyT33 created Jan 08, 2021 Views: 204 Replies: 5
Viewing posts 1 to 4

So I don't know if I could ask questions about code, but I am trying to make it so my character could rotate. I tried everything I could think of and still couldn't get it too work. If anyone is reading this, do you know what's wrong? 

The Code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerMovement : MonoBehaviour
{
    private Rigidbody2D rb2D;
    private float thrust = 10f;
    // Start is called before the first frame update
    void Start()
    {
        transform.position = new Vector3(0f, 0f, 0f);
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown("w"))
        {
          print("Test");
        }
        if (Input.GetKeyDown("a")){
          transform.rotation = Quaternion.Lerp(0f, 0f, transform.rotation * 10);
        }
    }
}