Hi Richard:
You can add a Position Motor on your door to make it as a power door. Here is a very good demo for it.
Physics > UseCase > Doors
Doors in doorways and Havok - Overshoot
Ok, the solution is the wrapper class hkpMalleableConstraintData
setStrength is how ridgid the angle limits are.
// Create constraint
m_hingeConstraint = new hkpLimitedHingeConstraintData();
m_hingeConstraint->setInBodySpace(pivotFrame, pivotDoor, axis, axis, zeroDegreeAxis, zeroDegreeAxis);
m_hingeConstraint->setMaxAngularLimit(0.0f);
m_hingeConstraint->setMinAngularLimit(-2.0f);
m_hingeConstraint->setSolvingMethod(hkpConstraintAtom::METHOD_STABILIZED);
m_hingeConstraint->setMaxFrictionTorque(20.0f);
m_hingeConstraint->setAngularLimitsTauFactor(2.0f);
m_hingeWrapper = new hkpMalleableConstraintData(m_hingeConstraint);
m_hingeWrapper->setStrength(1.0f);
m_ownerBlock->m_havokWorld->createAndAddConstraintInstance( m_companionDoorway->m_havokBody, m_havokBody, m_hingeWrapper )->removeReference();
For door latching we detect when the door is active and it's angle from getEstimatedAngle is near zero. Then set a flag that the door is latched, and set the movement type to STATIC. void SPDoor::latchDoor() { activate(); m_worldPosition = m_initialPosition; m_rotation = m_initialFacing; syncPositionAndRotationToHavok(); m_havokBody->setMotionType(hkpMotion::MotionType::MOTION_FIXED); m_isLatched = true; } void SPDoor::unlatchDoor() { activate(); m_havokBody->setMotionType(hkpMotion::MotionType::MOTION_BOX_INERTIA); m_isLatched = false; } (The activate is our game code, not havok's activate.)




Doors in doorways and Havok - Overshoot
I have a doorway with a side bar 0.1 x 0.1 meters and about 2 meters tall, and a door inside it. The door is about 0.2 meters smaller than the doorway and next to the side bar, so there is plenty of clearence. I'm using hkpLimitedHingeConstraintData for the hinge creation. I've looked at it in the Havok debug viewer and the door is not interpenetrating any where. There are angle constraints from 0 to 2 radians, so 0 is closed and 2 is way open. It all works about correctly, but for one thing: When you close the door it overshoots the 0 radian position and if closed hard, does not return back to the 0 position, so the door is slightly (maybe .2 meters) opn the wrong way out. How do you do a hard stop for a door, like real doors do? R. Keene Sandswept Studios.