void Start()
{
actions = GetComponent<LionActions>();
lionPlayerControls = GetComponent<LionPlayerControls>();
Rigidbody = GetComponent<Rigidbody>();
}
// Update is called once per frame
void Update()
{
var input = new Vector3(LeftJoystick.inputVector.x, 0, LeftJoystick.inputVector.y);
var vel = Quaternion.AngleAxis(CameraAngleY+180, Vector3.up) * input * 20f;
Rigidbody.velocity = new Vector3(vel.x, Rigidbody.velocity.y, vel.z)*-1;
if (input.magnitude > 0)
{
transform.rotation = Quaternion.AngleAxis(CameraAngleY + Vector3.SignedAngle(Vector3.forward, input.normalized, Vector3.up), Vector3.up);
}
else
{
transform.rotation =Quaternion.Euler(0,transform.eulerAngles.y,0) ;
}
CameraAngleY += TouchField.TouchDist.x * CameraAngleSpeed;
Camera.main.transform.position = transform.position + Quaternion.AngleAxis(CameraAngleY, Vector3.up) * new Vector3(0, 12, -15);
Camera.main.transform.rotation = Quaternion.LookRotation(transform.position + Vector3.up * 2f - Camera.main.transform.position, Vector3.up);
}
}
With touch Iim able to move my camera around player but only on a circle but ı want to be able to move camera up and down as well while cam looking at the player. How can I make it happen: