Help about understanding ceratin command problem
Im trying to use Camera.main.ScreenToViewportPoint(player.position) well since MainCamera is attached to player in hierarchy shouldnt this always give same position i mean player and camera move together and their relative position is the same but somehow when i use this on every frame its changing as player changes and it changes a lot ?
// Vector3 playerpos = Camera.main.ScreenToViewportPoint(rb.transform.position);
am i missing the definition of command or do i have a bug ?
Answer by Pangamini · May 14, 2019 at 08:40 AM
ScreenToViewportPoint takes a position in screen space and transforms it into a position in viewport space. You are feeding it with world position (that's my guess, I can't tell) which just does not make any sense. Actually I can't really tell what you are trying to do? Maybe try to describe what's your intended result
Your answer
![](https://koobas.hobune.stream/wayback/20220612201322im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
I build a own game but i have a cam problem 0 Answers
Locking Camera's rotation on a rolling character 0 Answers
How Use rigidbody.MovePosistion With A Player Controlled Moving Camera 0 Answers
Character Leaning 0 Answers
Making camera follow and rotate player 0 Answers