Hi everyone!
I want to implement possibility to control vehicle through rotating steering wheel.
But I have some problems with it.
I’m using SteamVR component “Circular Drive”. This script returns “Out Angle” - angle of steering wheel rotation, and this rotation I implement to the cars rotation.
Here is how my control script looks like:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Valve.VR.InteractionSystem;
public class carMovement : MonoBehaviour {
//Getting SteamVR Circular Drive comptonent
public CircularDrive OutputDataFromSteeringWHeel;
void Update () {
//Moving forward
transform.position -= transform.up * Time.deltaTime;
// Implementing rotation from steering wheel to the car
transform.eulerAngles = new Vector3(transform.eulerAngles.x, transform.eulerAngles.y, (OutputDataFromSteeringWHeel.outAngle * Time.deltaTime ));
}
}
But it seems to be using and adding cars rotation while it’s turning.
It’s rotates steering wheel, when I don’t do it.
**Here what is happening: DEV#002 | Steering Wheel Attempt - YouTube **
Please help to resolve that stuff.
Thank you!