I'm using Cinemachine for a free look 3rd person camera and a virtual camera for a lock on cam.

I already have switched Cinemachine brains and movement types done, but I need the player to face the target and to keep the player on screen. The player is set as the "follow" with the target as the "look at"

public void LockOnMovement()
    float nx = movementinput.x;
    float ny = movementinput.y;

    move3 = new Vector3(nx, 0, ny);
    Vector3 rotateMovement = Quaternion.Euler(Cam.transform.rotation.eulerAngles.x, 0, 0).normalized * move3;
    controller.Move(rotateMovement * runspeed * Time.deltaTime);

That's the players movement when locked on.

cam is the camera the Cinemachine brains are controlling.

  • \$\begingroup\$ How does the behaviour with your current setup and code differ from what you want? \$\endgroup\$
    – DMGregory
    Jan 11 at 22:15
  • \$\begingroup\$ well i need the player to stay on screen if u move in a certain the player will be off screen \$\endgroup\$ Jan 11 at 22:31
  • \$\begingroup\$ also im trying to make the lock on system like the one twilight princess if that helps \$\endgroup\$ Jan 11 at 23:20
  • \$\begingroup\$ It could help, if you edit your question to document the behaviour of Twilight Princess's lock on system and how yours currently differs from it. \$\endgroup\$
    – DMGregory
    Jan 11 at 23:24


You must log in to answer this question.

Browse other questions tagged .