So I’m trying to get a door to work correctly using physics (Minie) and it almost works but it’s not very stable again. i.e. it seems possible to almost pull the door out of its hinges (note that I’m using another New6Dof to grab the door). Here is the code:
private fun createHinge(gob: DtGob, game: Game) { val joint = New6Dof(gob.control, Vector3f.ZERO, Vector3f(gob.position.x, gob.position.y, gob.position.z), Matrix3f.IDENTITY, Matrix3f.IDENTITY, RotationOrder.XYZ ).also { setDoorHingeLimits(it) game.bulletAppState.physicsSpace.add(it) } gob.joint = joint val joint2 = New6Dof(gob.control, Vector3f.ZERO, Vector3f(gob.position.x, gob.position.y+2, gob.position.z), Matrix3f.IDENTITY, Matrix3f.IDENTITY, RotationOrder.XYZ ).also { setDoorHingeLimits(it) game.bulletAppState.physicsSpace.add(it) } gob.joint2 = joint2 } private fun setDoorHingeLimits(it: New6Dof) { it.setStiffness(3, 0.1f, true) it.setStiffness(4, 0.1f, true) it.setStiffness(5, 0.1f, true) it.set(MotorParam.LowerLimit, 0, 0f) it.set(MotorParam.UpperLimit, 0, 0f) it.set(MotorParam.LowerLimit, 1, 0f) it.set(MotorParam.UpperLimit, 1, 0f) it.set(MotorParam.LowerLimit, 2, 0f) it.set(MotorParam.UpperLimit, 2, 0f) it.set(MotorParam.LowerLimit, 3, 0f) it.set(MotorParam.UpperLimit, 3, 0f) it.set(MotorParam.LowerLimit, 4, 0f) it.set(MotorParam.UpperLimit, 4, 2f) it.set(MotorParam.LowerLimit, 5, 0f) it.set(MotorParam.UpperLimit, 5, 0f) }
So I’m basically using two hinges. With one it was even worse. So what’s the best way to get this working in a stable way? Thanks