Is it considered better to have doors freely pushable via a rigidbody (so if the door is halfway open and the player runs into it, the door swings on its hinge) or just allow the player to open and close the door by clicking on it / pressing E etc but without a rigidbody?
BEST PRACTICE : Don’t let the door hit you on the way out
It’s going to depend on the game. If I were playing Rainbow Six and doors opened automatically because I got too close it’d be annoying. In fact, I believe that automatic doors are a “hazard” in some maps, since they can alert enemies to your presence!
In more actiony games it might be good to free up the button and have the doors just open when I touch them.
The only “best practice” is to do what’s best for your game’s design and/or player expectations.
Well, the issue for me isn’t whether to have the doors open automatically but rather whether the player should be able to bump them and have them swing on their hinge via physics. The player will be able to open and close them by pressing a key/button, but if the player is in the way then the door will only open/close partway and hence the door might remain partway open for the player to bump into it later (although if the door script continues to open/close the door once the player gets out of the way, then I suppose that might not be an issue).
I don’t remember many games where doors were heavily physics-controlled, and normally they open by sliding sideways. Well, there was Dishonored, but the doors didn’t respond to physics, I believe.
The general idea is that the door shouldn’t slow the player down if the game is fast-paced, or that it should provide the player a pause to prepare for the horrors in the next room, if it is a slow-paced one.
I also recall that there was at least one game where ANY automatically closing door could murder the player by crushing them. That was a long time ago, though.
By the way, the usual thing that will happen with a physics-based door is that when you kick it open, it’ll fly open, bounce back and hit the player in the face.
I can’t recall a game with physics based doors.
I think painkiller black edition had some doors there were swinging around, and possibly half-life. Not sure. This is not the kind of thing you notice.
I vaguely recall seeing a door being open due to being shot at in some game, but I don’t remember where it was.
There was also “Murder at Masquerade Manor” (free game made in a week) in which the doors were just bumped open by the player running into them (they swung both ways on their hinge).