-2

I want my camera to follow the player rotation but the camera should always have an angle to the player. I have this:

transform.rotation = player.transform.rotation;

But now the Camera looks straight at the player and not at an angle from above. How can I add my wanted angle to the rotation? Thanks for your help!

2 Answers2

1
transform.rotation = player.transform.rotation + wantedAngle;
CHE6yp
  • 86
  • 7
  • my wanted angle change over time because when I rotate the player the camera angle changes so this doesn't work – Daniel Dev Aug 13 '18 at 09:07
  • 2
    Maybe you were mistaken? Maybe you actually DON'T want your camera follow the player rotation? Try: transform.rotation = wantedAngle; – CHE6yp Aug 13 '18 at 09:58
  • `Quaternion`s have to be combined using a multiplication `*` instead of an addition `+` ! – derHugo Aug 17 '18 at 16:01
0

I had to use

 transform.rotation = player.transform.rotation * Quaternion.Euler(45,0,0);