What I need is a way to automatically create an invisible border around the current tilemap (tile map uses simple rectangular tiles)
The player character uses
rb.movePosition(transform.position + direction * speed
direction comes from a custom joystick.
The camera (a pixel perfect camera, as the game is pixel art) is just simply set to be in the same position as the player.
What I want to do is to NOT let the player get out of the map and I don't want the camera to show the black parts around the map (places where nothing is placed), is there a good way to do this?
transform.position + direction * speedis a destination for where you want to be next frame / next physics step. Don't think so narrowly - it will block you from finding simple answers. \$\endgroup\$