Home>

Originally in script
if (Input.GetMouseButton (ROTATE_BUTTON))
{
rotateCmaeraAngle ();
}
private void rotateCmaeraAngle ()
{
Vector3 angle = new Vector3 (
Input.GetAxis ("Mouse X") * rotate_speed,
Input.GetAxis ("Mouse Y") * rotate_speed,
0
);

transform.eulerAngles + = new Vector3 (angle.y, angle.x);
}
I used to move the camera with the mouse, and right-click to target the enemy and point the direction of the enemy.
To avoid penetration
Collider with CinemachineFreeLook
It became non-penetrating in
Axis Control is automatically attached, so you can move it just by moving the mouse.
It's inconvenient because you can't target!
What should I do in this case?

  • Answer # 1

    Wouldn't it be better to use a normal Virtual Camera than FreeLook?
    If Aim is set to "Do nothing", the target will not be noticed without permission, and it will not interfere with the questioner's own camera control.
    However, since we want to use Cinemachine Collider together, it seems that we need to set the target of attention to Look At even though we are not doing automatic attention.

    If you want to control the camera tracking for the player, you should set the body to "Do nothing".