is there anyone out there who knows how i can check if the colliding object is object?
what i accualy mean is, is there something to do the following:
public Transform SomeOBject;
void OnCollidionEnter (Collision other){
if(other==SomeObject){
print(“other is SomeObject”);
}
}
is there anything that does this? cause what i just typed is not possible, and gives shitloads of errors.
many thanks to the people who awnser!
I can probably give you the answer you're looking for, but first I need to know: How is the other object created? How are you keeping track of it? (Which might be the whole issue - if you're not) Is the "SomeObject" a "type" or a specific instance of an object?
Collision is not the same as Transform; they are two different types so they can’t be compared with operator ==. You can however compare two of the same type are identical.
From here, you can see that Collision has information stored about the object it berlongs to. Namelt, it has a rigidbody, a transform, a gameObject, and a collider references.
not where i'm aware of. the SomeObject that i'm trying to compare is found by this Transform nextWaypoint = transform.Find("/" + WaypointBox + "/Lvl_Test_Waypoint_" + WaypointBox + "_" + TenWayNum + OneWayNum); and the "other" is set by the trigger it in. and i dont get a Null when i print the transform.find.
And they're directly connected - the collider is on the way point? And you have spelled it OnCollisionEnter not OnCollidonEnter as it appears in your question and this answer?
I can probably give you the answer you're looking for, but first I need to know: How is the other object created? How are you keeping track of it? (Which might be the whole issue - if you're not) Is the "SomeObject" a "type" or a specific instance of an object?
– Dracorat