Opening door with script.

So I have a door object that has an animation on it that opens the door, it also has a parameter that turns the animation on when the value is true. But how do I change the value form false to true when the player enters a hitbox, so the door opens. Would I use a script or something else? - Thanks

Obviously you need to replace the mouse button press with the collision detection.

What do you mean?

Most likely a script yeah.(everything is a script one way or the other, extra true if we’re in the matrix)

  1. have a trigger on the door

void OnTriggerEnter(){

Animator anim = //get a reference somehow
anim.SetTrigger/SetBool/what ever
}

Dose that code need to be on the player, the door, or the trigger?

Also where do you get the reference is it a rigid body, a game object, or something else?

I think you need to stop and go here first: Learn

Here I used the Google for you. :slight_smile:

1 Like

ok

thanks.

I love the way it phrased it. lol

Thanks it works like a charm!