- Home /
Question by
tulloch100 · Aug 04, 2017 at 06:32 AM ·
rotationcarrotation detection
Turn Steering wheel on Key press
I have a script at the moment that allows me to rotate the steering wheel left and right via the inspector. But want i want to be able to do is have the steering wheel move left and right when I press the left and right arrow.
using System.Collections;
using UnityEngine;
public class SteeringWheelRotation : MonoBehaviour {
[Range(-45f,45f)]
public float steeringWheelRotationAmount = 0f;
public float wheelRotationDampening = 0.5f;
public Transform frontLeftWheel, frontRightWheel;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
transform.eulerAngles = new Vector3 (transform.eulerAngles.x, transform.eulerAngles.y, -steeringWheelRotationAmount);
Comment
Your answer
Follow this Question
Related Questions
Rotate object based on rotation of SteamVR Controller? 2 Answers
Translating in world space only on y axis? 0 Answers
Need help with car rotaton 0 Answers
Increment snapping and rotation 0 Answers
How do I limit my car's z rotation when a key is pressed? 0 Answers