Need help with boundaries
I'm trying to put in boundaries for a 2-D game, but my game object seems to ignore all physics and just falls straight down, going through the boundary too. Can someone help me?
GetComponent<Rigidbody>().position = new Vector2(
Mathf.Clamp (GetComponent<Rigidbody>().position.x, boundary.xMin, boundary.xMax),
Mathf.Clamp (GetComponent<Rigidbody>().position.y, boundary.yMin, boundary.yMax));
Comment
Your answer
Follow this Question
Related Questions
How to prepare your scene to build and run? 1 Answer
How do you make your player jump in the Roll-a-Ball tutorial series? 0 Answers
Character movement with click 1 Answer
all compilers have to be fixed befor entering game mode .. 3 Answers
Recognize when ever camera looks up and turns back down 0 Answers