- Home /
Inverted colliders?
Hey, is it somehow possible to revert colliders so that object cannot leave colliders, but can move freely within them? I immagined i'd be able to do this with some is trigger colliders for the allowed areas, but have been unable to make anything work. So my question is: Do you know of a way to get this behavior, or can you point me in a direction where i could discover one?
Thanks.
Answer by dbchest · Jul 12, 2019 at 06:10 PM
@teiselaise the behavior you want to emulate is pretty easy to setup; the short of it is to establish what the boundaries are going to be and test an object's position against them to ensure they cannot leave the safe zone. the following link can help you with the setup: https://learn.unity.com/tutorial/game-setup-player-and-camera# : refer to tutorial #5 on player movement to get a basic understanding of object restraint by position. consider if autonomous movement is being used for some of your objects, in which case you would need to integrate the boundary test into the AI auto movement as well. Good luck!
Your answer
Follow this Question
Related Questions
Character is hitting the ground but not collisions are being detected. 2 Answers
Android collision issues 0 Answers
Creating a "Connection" between two game objects using another game object. 0 Answers
2D Collision with tags not working,2D Collision using tags not working 0 Answers
Scale object, collision not working 2 Answers