How could I implement a vertically-sliding door?
sixFingers opened this issue ยท 1 comments
Not really an issue, but I couldn't find a better place to ask about this. ๐
I'd like to implement a sliding door: in short, it should behave like a static body, but I'd like to be able to animate its position (either vertically or horizontally). Could you share any quick pointers to the right approach with qu3e? I'm evaluating possible candidates for my game physics and I'd like to get a better idea before getting into code.
I love how simple and lightweight qu3e is, great job!
The best way is to make your door a eKinematicBody
. Kinematic bodies are like dynamic bodies, but do not react to collisions (they have infinite mass). Then you can set the velocity of your door, and the physics engine will move it for you. Other dynamic bodies that hit the door will be pressed away or squashed appropriately.
Typically your player controller will also be implemented with a kinematic body. Kinematic bodies do not collide with one another -- the idea is you would code in your own custom logic for handling collisions between the player and the world. But, if this is too much work, you can try making your player controller with a dynamic body, and manipulate the dynamic body by applying impulses. In my opinion using a dynamic body here is more difficult to tune, and in the end inferior to using a custom kinematic body solution.