I’m making a top-down shooter with an auto-scrolling camera. The player needs to move freely around the screen but not be able to exit the screen. It seems that Unity 5 changed how colliders work so my only option is to have a rigid body on my player. But the problem is that with a rigid body, colliding with walls using transform.position creates endless drift since there’s no realistic physics applied to my game. But I can’t use “Is Kinematic” because doing so prevents collisions with non-trigger colliders, which I’m using for walls. So I’m stuck using the AddForce() method of movement. The problem now is that I can’t seem to clamp my position into the camera without creating that drift again. I’ve tried using several styles of converting world to screen point and view point and back and none seem to work at all. Most even ended up worse than the drift. I’m not interested in simply making colliders at the edge of the camera view since then I can’t move them very well since they’d only be relevant on fixed updates. So now I’m completely out of ideas. Can someone help?
You could always try clamping it to the size of the screen.