hey guys,
i was just wondering if there was a simple way to check if:
an object is colliding with another certain object,
and to check if an object is colliding with any object.
thanks
-Grady
hey guys,
i was just wondering if there was a simple way to check if:
an object is colliding with another certain object,
and to check if an object is colliding with any object.
thanks
-Grady
THE FOLLOWING SCRIPT IS JAVA SCRIPT
//start of script
var otherObjectTag = “Object”;
function OnCollisionEnter (hit : Collision)
{ ///you are colliding
Debug.Log(“CollidingWithAnything”);
if(hit.gameObject.tag == otherObjectTag){ //now colliding with certain object
Debug.Log(“Colliding With Certain”); }
}
///end of script
DO NOT COPY THIS OR ANYTHING PAST
hope it works
you have to add a collider besides the Character Controller for this to work but that shouldnt mess anything up. just go to Component>Physics>(Id recomend capsul collider) then make sure the capsule collider is bigger then the CharacterController