1
\$\begingroup\$

Basically my camera follows the character rotation and position, although the position of it its pretty uncomfortable to use, this is what I needed: enter image description here

But this is what the I get: enter image description here

I used a code that someone suggested me yesterday to use, I got a bit creative with it and changed some stuff to get other camera positions, but no matter how much I tweak the values the camera never gets the position that I need:

void LateUpdate()
{
    transform.position = player.transform.position - (player.transform.up * -10) + (player.transform.forward * -15);
    transform.LookAt(player.transform);

}

I have no idea how I can make it show less of the player back

\$\endgroup\$
1
\$\begingroup\$

You need to elevate camera position upwards, add some arbitrary value you like as the elevation variable and you're good to go.

float elevation = 1.0f;//Value that you'd want to tweak
transform.LookAt(
    player.transform.position + player.transform.up * elevation, 
    player.transform.up
);

Also you'll probably need to decrease distance between camera and the player.

(player.transform.forward * -15)//It's here, tweak it
\$\endgroup\$
  • \$\begingroup\$ Theres only 1 problem, it says + cannot be applied to operands of type transform and vector 3 (sorry im kinda slow xd) \$\endgroup\$ – Hugo Sousa Jul 5 '19 at 11:13
  • \$\begingroup\$ Found the problem :D I simply added position at the player.transform and now I dont have any error and your code worked, thank you so much Ocelot :3 \$\endgroup\$ – Hugo Sousa Jul 5 '19 at 11:23
  • \$\begingroup\$ @HugoSousa I've made an edit anyway. \$\endgroup\$ – Ocelot Jul 5 '19 at 11:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.