- Home /
transform the other object?
How exactly would I write a collision script with transform commands if I wanted the OTHER object to be affected, not the object the script is attached to?
function OnControllerColliderHit (hit : ControllerColliderHit) { if (hit.gameObject.name == "door")
transform.position += Vector3(0,2,0); }
So right now it is affecting the object the script is attached to, how would I make it so the script affects the object it is colliding with?
Comment
@$$anonymous$$ikezNesh: no, it's just not using any brackets at all, which is legit. (The spacing in that code is not good though.)