Sorry for the delay, I had to travel for work.
I tried initializing qframe and qframe as LineConstraint did but I still must have something messed up. My code looks like this now:
Code: Select all
Matrix34 entityTM = m_pEntity->GetWorldTM();
IPhysicalEntity *pPE = m_pEntity->GetPhysics();
Vec3 axis = Vec3(0, 0, 1);
ac.flags = world_frames | constraint_no_tears | constraint_line;
ac.pBuddy = WORLD_ENTITY;
ac.xlimits = 1.0f;
ac.xlimits = 0.0f;
ac.pt = ac.pt = entityTM.GetTranslation();
ac.qframe = ac.qframe = Quat(entityTM) * Quat::CreateRotationV0V1(Vec3(1, 0, 0), axis);
ac.damping = 10;
In this configuration I can push the door over, it's like it's pinned over the X axis rather than Z. By setting axis to 0,0,1 the entity rotation is constrained to only rotating on the Z axis? I tried 1,0,0 and 0,1,0 also but the door rotation was not constrained to the Z axis. Is the problem the first term in Quat::CreateRotationV0V1? Should it be Vec3(0,0,1)? I tried playing with that but couldn't get it to work right.
I've got to be close, any ideas what else I can check? Thanks again for your help.