i just need help to make the door move when something is on the pressure plate
1 Answer
1Hello!
this tutorial will teach you how can check for collisions, so that when an object enters a collider box that is placed above the pressure plate, some variable will be set to ‘true’.
The next step is to check whether or not that certain object has a certain mass, since you might only want objects with a mass > a certain value to be able to open the door. To check the mass of a rigidbody, you can use Unity’s documentation.
Now you can set the Boolean to be only true when the collider of the rigidbody is colliding with the collider on top of that pressure plate that functions as a trigger, AND when Rigidbody.Mass exceeds a certain value. Then in your script you can do something like this:
if(Boolean == true)
{
Open();
}
Note that this code won’t work like this, but it gives you an idea on how to achieve the opening of the door. For the opening of the door you might be interested in checking this asset I created. With this asset you’ll simply have to call the Open(); function that is located in the Door script only when Boolean == true.
Hope this get’s you on the right path to solving your problem!