Im new in Unity , i make a car game but i want to make “Pop Up Headlights”. I want when i press “K” Headlights to pop up, and then when again press “K” headlight go down. Please help me. Thank in advance.
You must only redo my script.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PopUpLights : MonoBehaviour {
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetKey("l"))
{
transform.localRotation = Quaternion.Slerp(transform.localRotation, Quaternion.Euler(290, 0, 0), Time.deltaTime * 5);
}
if (Input.GetKey("o"))
{
transform.localRotation = Quaternion.Slerp(transform.localRotation, Quaternion.Euler(0, 0, 0), Time.deltaTime * 5);
}
}
}