How to implement door/elevator "squish" behavior? #24
-
Hi! I have door or elevator (kinematic convex hull with attached linear and angular motor that moves it up and down). How handle situation when player (character controller) or other entity (box, barrel) get stuck in door or elevator and prevents them from moving? Naive implementation No1 just pushes object through the static geometry Questions: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
One approach would be to examine the accumulated impulses associated with the contact constraints on the kinematic elevator. If contact contact constraints are applying a lot of force to the kinematic, it is probably squishing something (or the object's just very heavy). You could stop the kinematic's progress or even reverse it a little bit in response. After a little while of not detecting the excessive impulse, you could return it to the usual movement pattern. You could also make the elevator a dynamic body with constraints that make it act elevator-y; the motor raising and lowering the elevator could be given a maximum force that doesn't make it smash stuff through walls. Depending on your goals, this might be the easiest approach, especially for doors. |
Beta Was this translation helpful? Give feedback.
One approach would be to examine the accumulated impulses associated with the contact constraints on the kinematic elevator. If contact contact constraints are applying a lot of force to the kinematic, it is probably squishing something (or the object's just very heavy). You could stop the kinematic's progress or even reverse it a little bit in response.
After a little while of not detecting the excessive impulse, you could return it to the usual movement pattern.
You could also make the elevator a dynamic body with constraints that make it act elevator-y; the motor raising and lowering the elevator could be given a maximum force that doesn't make it smash stuff through walls. Depending o…