- Home /
How to get box collider detection by Ray cast only from the outside of the box collider
All I want is my player to be able to detect an object (base) only from the inside
Answer by Rayeloy · Apr 17, 2019 at 06:06 AM
Did you make a typo the first time? you first said in the title you want to check from outside and then you said from the inside. Whatever it is, afaik you can only check from outside. If your game is 2D you can use Physics.Raycast2D https://docs.unity3d.com/ScriptReference/Physics2D.Raycast.html Or if it's 3D use Physics.Raycast or even linecast: https://docs.unity3d.com/ScriptReference/Physics.Raycast.html
If what you want is to detect if your player is inside a "base" then why not define a collider for the whole base and then check OnTriggerEnter/ OnTriggerStay (depending on what you need) from the base object. I need more information to give you a more appropiate answer.
This is exactly what I did, sorry for confir$$anonymous$$g late, I was new to unity, I struggled a bit to get used to it, thank you