Swing a door open so it knocks the wall once or twice and then stays still
A door that stops dead at the wall feels stiff, and one that keeps trembling forever or sinks into the wall looks broken. Here is how to let it hit the stop, bounce back less each time, and come to a real rest.
Why this works
Heavy things lose a bit of their push every time they hit something, so each knock is smaller than the last. Letting the door give back only part of its speed, and calling it still once it is slow enough, ends the motion for good.
When not to use it
Skip it for a door that opens by itself or on a button press, like a lift or a sliding gate. Those should move the same way each time, so play a fixed animation, because a bouncing door would look broken there.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 4 common mistakes and the fix
- A diagram of every state
- 32 lines of example code with 4 checks that pass
- How your AI shows you that it works
Say this to your AI
Use the Spielerando entry "Swing a door open so it knocks the wall once or twice and then stays still" (read_entry door-swings-open-and-knocks-the-doorstop) in my game. Build it step by step, and show me how you checked that it works.Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP