Hello, I’m making a game using the oculus rift and kinect, so based on the oculus rift’s head movements, I have the character follow it’s y rotation. The problem is, moving the oculus to the left or right makes the character and camera (which is the child) spin really fast. I was looking into turning down the oculus sensitivity, but it seems less realistic, but it would be ideal with to some how fourth the turn space of the oculus so you had to look 4 times as high to get the same rotation.
So, I need to fix the line “transform.eulerAngles = (Vector3(0, (CamRotate),0));”, which works, but it needs the lerp or whatever it may need. When I use Vector3.Lerp, it wants a set up like (start, end, y, speed), but I can’t do that when I have the (x, y, z) set up. I’ve tried all of the unity documentations on lerp, slerp, Quaternion, and mathf in various ways, a lot of them only talk to Vector when it’s like “Vector.Up” or when the () are set up with just one positional value. eulerAngles was the only format of rotate that seemed to work, I’m a bit unfamiliar with it and the way it talks to vectors. What the script does is finds Camera Y value, and Character Y mimics it when the head is turned more than 10. I need something like “transform.eulerAngles = (Vector3.lerp(0, CamRotate, 0, Time.deltaTime * smooth));” my brain is fried, any help would be very appreciated.
var Cam : GameObject;
var CamRotate : float;
var PlayerRotate : float;
var smooth : float;
private var velocity = Vector3.zero;
function Update () {
CamRotate = Cam.transform.eulerAngles.y;
PlayerRotate = transform.eulerAngles.y;
if ((CamRotate > (PlayerRotate + 10))||(CamRotate < (PlayerRotate - 10))){
transform.eulerAngles = (Vector3(0, (CamRotate),0));
//I need help on this line ^^^ It works, but I need PlayerRotate to lag behind CamRotate. Simliar to SmoothFollow/SmoothLook
//PlayerRotate = (Vector3(0, CamRotate, 0, Time.deltaTime * smooth));
// var rotation = Quaternion.LookRotation(CamRotate.position - transform.position);
//transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Time.deltaTime * smooth);
}
}