i try to create my first game with unity (iphone). I want to know a good solution for determining wheather my car is parked into its slot completely and straightly. So i use a trigger cube - but it triggers immediately (OnTriggerEnter). Is there any way to check wheather my object (car) is completely in this trigger (cube)?
Maybe you could use an additional trigger outside of the “correct” zone, so when the car is colliding with the correct zone and has stopped colliding (OnTriggerExit) with the outer zone, it will have fully parked.
Once the car is in the correct zone fully, they should no longer be triggering the external zone.
If you surrounded the correct zone with 4 of these, you could detect if the car was in any way outside of the correct parking zone.
If you create a Bounds object from your parking collider, a simple bounds.Contains(point) will tell you if a point is inside. All you need to know then, is the positions of the corners of boxCollider of your car in local space.
To get those points, make Vector3 objects for each of the four corners of the car boxCollider (assuming height is irrelevant), and use car.transform.TransformPoint and parkingSpot.transform.InverseTransformPoint to convert each of them into local space of your parking spot.
This calculation is only needed during OnTriggerStay and could save you some colliders.