ok. i normally post in here as a last resort…
i have been dealing with this problem for close to 2 months now. i have tried nearly every possible combination of code suggested to me.
my camera is attached to my head, which is rigged to my character. this is only in first person view.
when i walk forward, the screen swings from side to side. now i understand why it is doing this, but what i dont understand is how to fix it.
heres the code with some combinations you can see commented out that ive already tried:
if (firstPersonView == true Input.GetKey(KeyCode.W) !Input.GetKey(KeyCode.LeftAlt) getInVehicle.inDriver == false getInVehicle.inRover == false getInVehicle.inShuttle == false) {
headBounceSensitivity = .1;
// cam.transform.LookAt(lookBox);
//cam.transform.parent = null;
//cam.transform.position = camParent.transform.position;
//cam.transform.position.y += .1;
//camParent = transform.root;
//var rotation = Quaternion.Euler(0, 30, 0);
//cam.transform.localEulerAngles.y = 0;
//cam.transform.Rotate ( 0, - (cam.transform.localEulerAngles.y), 0);
//var mank = target1.localEulerAngles
//cam.transform.eulerAngles = new Vector3(cam.transform.eulerAngles.x, target1.transform.eulerAngles.y, cam.transform.eulerAngles.z);
///var dickson = cam.transform.localEulerAngles.y ;
//cam.transform.Rotate (0, dickson, 0);
//transform.localRotation = Quaternion.identity;
//localEulerAngles = new Vector3(-rotationY, rotationX, 0);
thePosition = cam.transform.eulerAngles.y;
endPosition = 0.0;
cam.transform.eulerAngles = Vector3(0, Mathf.Lerp(thePosition, endPosition, 1.0), 0);
//cam.transform.localEulerAngles.y = Mathf.Lerp (cam.transform.localEulerAngles.y, 0.0, 0.02);
//cam.transform.localEulerAngles.y = 0;
Debug.Log ("cam local euler y is " + cam.transform.localEulerAngles.y);
//cam.transform.rotation = ( cam.transform.rotation.x, 0, cam.transform.rotation.z);
//cam.transform.localEulerAngles = Vector3(0.0, 0.0, 0.0);
//thePosition = transform.TransformPoint(0.0, 0.0, 12.0);
//cam.transform.LookAt (thePosition);
//wantedRotationAngle = 0.0;
//currentRotationAngle = transform.eulerAngles.y;
// Damp the rotation around the y-axis
//currentRotationAngle = Mathf.LerpAngle (currentRotationAngle, wantedRotationAngle, 0);
//currentRotation = Quaternion.Euler (0, 0, 0);
//cam.transform.rotation = currentRotation;
cam.transform.localRotation = Quaternion.Euler(0,0,0);
//var target = Quaternion(0.0, 0.0, 0.0, 0.0);
//cam.transform.rotation = Quaternion.Slerp(cam.transform.rotation, target, .01);
//Debug.Log ("camparent Local euler y is " + camParent.transform.localEulerAngles.y);
//Debug.Log ("camparent Global euler y is " + camParent.transform.eulerAngles.y);
//Debug.Log ("cam Global euler y is " + cam.transform.eulerAngles.y);
//Debug.Log ("cam local euler y is " + cam.transform.localEulerAngles.y);
}
i figured if i just made the cam.transform.rotation.y = 0 that would work but has no success.
ive also tried these lerps, slerps, berpz on fixed update, late update, with different time.time, time.delta time. .01, 0.0, 0.02, etc etc
please help!!!
GoonCorp