var obj : GameObject;
function Start () {
obj.GetComponent.<Collider>().BoxCollider.Collider = false;
}
function OnTriggerEnter (other : Collider) {
if(other.gameObject.tag == "Player") {
obj.GetComponent.<Collider>().BoxCollider.IsTrigger = true;
obj.GetComponent.<Collider>().BoxCollider.Collider = true;
}
}
I wrote this script but it’s not working, any suggestions? ![]()
What do you mean by "not working"? Are you getting compiler errors? Or is it not working at runtime?
– the_geniusYou can only create an empty object with a trigger collider, set it not active and when you want you can active it!
– LogandotworkThat does look to be working properly, although it would appear the view-to-world transformation isn't happening (again, I would imagine a bug in shader graph). In that case, I would suggest also providing the cameraToWorld matrix in the same way you provide the inverse projection matrix and multiply the point by that rather than using the transform node.
– Namey5