Question by
Yurivalen · Oct 29, 2021 at 11:25 AM ·
2dscripting problemcamera-movementfollow playerspeed issues
SOLVED: How to properly follow in high velocity in 2D?
So I have a script attached to the main camera to follow the player's exact position:
transform.position = new Vector3(Target.GetComponent<Rigidbody2D>().position.x,Target.GetComponent<Rigidbody2D>().position.y, transform.position.z);
which works fine until the player's velocity gets really hight(I'm making a very open 2D space game, so the player maybe traveling very fast) then the camera lags behind the player as he's speed gets higher. how do I fix this? I need the player in the middle of the screen even in high velocities. thanks in advance to whoever responds, see illustration pic Below.
FIXED: I had the code under FixedUpdate(), changed to just Update().
problem-illustration.png
(161.1 kB)
Comment