the script applies to everyone who has the script, not the individuals

I have a script called in the update that goes:

if (rbi.isKinematic == false) {

headroll.headroller = headroll.headroller + 1f;
Debug.Log("Hello");

}

it’s attached to a few different objects, however, when the code is activated, through this code:

void OnTriggerEnter (Collider other){

        if (other.tag == "proj") {

            Rigidbody rbi = gameObject.GetComponent<Rigidbody>();
            rbi.isKinematic = false;

}

it activates the first code I showed here for every object the script is on, when I would like it to only activate when that particular object is hit

I debugged it and it registers that it hits but it turns the “isKinematic” option off for every object, when I would only like to when that particular object is hit

Hope I explained it well enough. Any help would be great, thanks

Have you set the Script/Class or any of its members as static?

That script will only trigger if there is a trigger collision between that specific object, and an object tagged with “proj”.

This is the big problem with tags - it’s hard to figure out exactly what’s tagged with a tag in a scene, and forgetting to remove tags can cause major glitches.

To debug this, try adding this to your OnTriggerEnter:

if(other.tag == "proj") {
    Debug.Log("This object: " + gameObject.name + " registered a colision with this object: " + other.gameObject.name);
    ...
}

That’ll tell you a lot more about what collisions are happening.

Yes. I //'d it out and tried again but still doesn’t solve my problem :confused:

the collision isn’t the thing that’s causing me the problem. the problem is that it only registers the IsKinematic becoming false once, whereas I need it to register it for every object it hits