i try to make car game… i want to make when it reach the way point. way point that i use is box game object and i tag it into trackLap. but it didn’t call this function. i dun know which is appropriate function should i use for this problems.
function OnControllerColliderHit(hit : ControllerColliderHit)
{
if(hit.gameObject.tag == “trackLap”)
{
print(“yay i pass the lap”);
}
}
i got the solution of this… ok but my other question… How to detect when 1 object collide with other gameobject that had no collider, no rigidbody. just only tag.
The collision won’t be reported if there is no collider or rigidbody, but you can actively check for collisions in the script. The Physics class has a few functions to help with this: OverlapSphere, CheckSphere and CheckCapsule. The objects checked against the sphere/capsule do need to have colliders for these functions to work. If none of the objects have colliders then you probably can’t do much more than a simple proximity check. You can use Vector3.Distance to check the distance between the positions of two objects (or use the sqrMagnitude property if efficiency is an issue).