Check if trigger includes an object and not just a part of it

Hello everyone!

I am developing a car simulator game for kids ( a driving licence test)
I have a car to park and I have a box collider at the place of the parking area.
I need to check if the car(which has a box collider attached), belongs to the parking area.

If I use the regular OnTriggerEnter function, it will return true when just the edge of the car has been touched, I need a control to check if the whole car belongs to the area.
Any hints about this?

I don't know how to solve that problem in a way you described, but you can make vice-versa: you can make four box colliders around your parking area, and if your car leaves that collider, you'll catch OnTriggerExit event

–

well its a nice idea, i'll give your way a try, but I think there must be a simpler way to do so

–

1 Answer

1

I would surround the parking area with other triggers that make up one big box including the parking area trigger.

Then if the car is triggering the parking area collider but not the outside ones, you can safely say they parked the car :slight_smile:

It seems this is the solution, a close answer to Rustam Ganeyev..f I will try and then set the answer as true:)

–