i want to rotate camera arount an obj and i need it to do without Z changing. [syntax=csharp] void Update(){ Vector3 v3; v3.x = Input.GetAxes("Vertical");//-_uj.TouchAxisRight().y; v3.y = Input.GetAxes("Horizontal");//_uj.TouchAxisRight().x; v3.z = 0; v3 = _camTransform.TransformDirection(v3); v3.z = 0; _camTransform.RotateAround(_target.position, v3, 200* Time.deltaTime); }[/syntax] this is the third person view camera and i cannot add something like(Below) at the end of code [syntax=csharp] _transform.eulerAngles = new Vector3(_transform.eulerAngles.x, _transform.eulerAngles.y,0);[/syntax] because it will make rotation and then make fixing, which can be seen by user. so, how to fix v3 before i put it into RotateAround method
Why can't you just set the _camTransform's z to 0 immediately after RotateAround()? Why do you have to set another transform first?
ive done it with this Code (CSharp): Vector3 v3 = new Vector3(_transform.eulerAngles.x - swipeDelta.y, _transform.eulerAngles.y + swipeDelta.x, 0); v3.x = ClampAngle(v3.x, minimumY, maximumY); Quaternion rotationTo = Quaternion.Euler(v3); _transform.rotation = Quaternion.Slerp(_transform.rotation, rotationTo, Time.deltaTime * _camRotSpeed);