VR Touch Steering Wheel
So I wanna make a game with car controls just like this.
Currently using the latest version of Oculus Rift.
I'm so close to it but I can only code the joystick (of the left hand controller) to control the steering wheel, not the user's hands. 

The thought process behind the following code below is that:
- Detect collision between user's hand and steering wheel (Success).
- Detect if user is gripping hand (Success).
- Detect if one hand is higher than the other (Can detect positions of both hands and compare values of the y-axis coordinates).
- Animate steering wheel based on which hand is higher. For example if the right hand is higher, rotate steering wheel to the right, left hand higher = rotate steering wheel to the left. (Fail)

[code=CSharp]using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Oculus_Steering : MonoBehaviour
{
public GameObject rightHand;
public GameObject leftHand;
float maxTurnAngle = 45f;
// Detect Collision with Player
void OnTriggerEnter (Collider other) {
Debug.Log("hello");
Debug.Log("LEFT: "+OVRInput.Get(OVRInput.Axis1D.PrimaryHandTrigger)+" and "+ Mathf.Abs(leftHand.transform.position.y));
Debug.Log("RIGHT: " + OVRInput.Get(OVRInput.Axis1D.SecondaryHandTrigger)+" and " + Mathf.Abs(rightHand.transform.position.y));
//when leftHand elevation is higher turn wheel to left
if (Mathf.Abs(leftHand.transform.position.y) > Mathf.Abs(rightHand.transform.position.y))
{
transform.localEulerAngles = Vector3.back * Mathf.Clamp(-97, -maxTurnAngle, maxTurnAngle);
}
else
{ //when rightHand elevation is higher turn wheel to right
transform.localEulerAngles = Vector3.back * Mathf.Clamp(97, -maxTurnAngle, maxTurnAngle);
}
}
void Update()
{
//for joystick; takes the horizontal input to determine if steering wheel should rotate left or right
transform.localEulerAngles = Vector3.back * Mathf.Clamp((Input.GetAxis("Horizontal") * 100), -maxTurnAngle, maxTurnAngle);
}
}
I'm fairly new to unity and coding so if you need any more information, please don't hesitate to ask!
Thank you in advanced.
P.S. I am currently using the latest version of Oculus Rift. I will provide the version of game engine, and a copy of the scene I am using in the comments below later in the morning.
Edit: Using unity 2018.3.11f1 and the file is too large whoops.
P.S. I am currently using the latest version of Oculus Rift. I will provide the version of game engine, and a copy of the scene I am using in the comments below later in the morning.
Edit: Using unity 2018.3.11f1 and the file is too large whoops.
