I have an airplane and I am trying to make it tilt when I turn left right, up down, however, I don’t know how to do that, and I have looked around quite a bit, but nothing has worked.
Here is what I have so far:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
void Update ()
{
Rigidbody rb = GetComponent<Rigidbody>();
if (Input.GetKey(KeyCode.A)) rb.AddForce(Vector3.right);
if (Input.GetKey(KeyCode.D)) rb.AddForce(Vector3.left);
if (Input.GetKey(KeyCode.W)) rb.AddForce(Vector3.back);
if (Input.GetKey(KeyCode.S)) rb.AddForce(Vector3.forward);
if (Input.GetKey(KeyCode.Space)) rb.AddForce(Vector3.up);
if (Input.GetKey(KeyCode.LeftShift)) rb.AddForce(Vector3.down);
}
}