Player boundary restriction
I have a quad surface over which my player does his activities. On moving beyond the quad, player falls off infinitely. I have seen this being achieved using Mathf.clamp function. What are all the other possible ways I can restrict the player falling off of the quad? Any links to basic tutorials would help
Answer by Tasarran · May 02, 2017 at 05:50 PM
All the ways? I don't know if it is even possible to list ALL the ways, but here's a few:
You can do what you said and clamp the actual position with an Update function that keeps the position inside a set area. Drawback on this is that the area must be a rectangle of some size.
Another way is to actually put walls around the area. If you don't want to see them, turn off the Mesh Renderer, just use the Collider.
Or, you can just make the ground plane bigger.
I'm sure there are some other techniques, but this should be enough to get you started.
Your answer
Follow this Question
Related Questions
OnTriggerExit does not work 0 Answers
How can the UI "ask" for a certain object 0 Answers
AddRigidBody Script Error 1 Answer
How to get contact points between a mesh collider and a line? 1 Answer
Change Scene with Physics Raycasting 1 Answer