So I made some improvements on getting a door to work. It is starting to be ok but I still have some issues as you can see in the linked video. The linked gist contains all code I have so far for this: Physics door test · GitHub
Basically the problem is that it works relatively ok while I’m holding the door. As soon as I release the grab though the door starts swinging heavily for a while. I’m not sure how to solve that problem. Any clues are welcome. Thanks!
So I added the setDamping() as you suggested but it still swings heavily when I release the door. Also I was using an EmptyShape so I think there is already no collision between the handle and the door but I did add the setCollisionBetweenLinkedBodies(false) too.
Well basically the clue was adding the doorframe (or geometry that touches the door) to the ignore list of the door. Then the hinge is created as follows:
gob.joint = HingeJoint(gob.control, Vector3f.ZERO, gob.position.asVector(),
Vector3f.UNIT_Y, Vector3f.UNIT_Y, JointEnd.B).also {
val o = FastMath.TWO_PI - gob.orientation.y
it.setLimit(o, o + FastMath.HALF_PI)
game.bulletAppState.physicsSpace.add(it)
}
And that basically does it. After all pretty simple but I never though that the surrounding geometry would be the problem