I'm currently writing code for a trebuchet, the arm of which is a
ragdoll and it's sling is a prop_physics entity.  The sling needs to be
attached to the arm via ropes.  Creating the actual rope is easy enough
but I'm having trouble with setting up length constraints between the
sling and the arm.  It appears that when the arm swings round (it's
attached via a hinge constraint to g_PhysWorldObject) the attachment
point of the length constraint doesn't move with it and I'm not entirely
sure why.  I guess it could be something to do with the arm being a
ragdoll and taking a look at the IPhysicsConstraint interface definition
I see there's a UpdateRagdollTransform function.  However I'm not
entirely sure what you need to pass for the two matricies.  This is the
code that I'm using to setup the constraints:

m_Sling->GetAttachmentLocal("Rope1", Rope1SlingAttach, none);
m_Sling->GetAttachmentLocal("Rope2", Rope2SlingAttach, none);
m_ArmRagdoll->GetAttachmentLocal("RopeHook", RopeHookAttach, none);

Rope1ConstraintParams.Defaults( );
Rope1ConstraintParams.objectPosition[0] = RopeHookAttach;
Rope1ConstraintParams.objectPosition[1] = Rope1SlingAttach;
Rope1ConstraintParams.totalLength =     TrebRopeLength.GetFloat( );
Rope1ConstraintParams.minLength = 0.0f;

Rope2ConstraintParams.Defaults( );
Rope2ConstraintParams.objectPosition[0] = RopeHookAttach;
Rope2ConstraintParams.objectPosition[1] = Rope2SlingAttach;
Rope2ConstraintParams.totalLength =     TrebRopeLength.GetFloat( );
Rope2ConstraintParams.minLength = 0.0f;

Assert(m_Sling->VPhysicsGetObject( ));
Assert(m_ArmRagdoll->VPhysicsGetObject( ));

m_Rope1Constraint =
physenv->CreateLengthConstraint(m_ArmRagdoll->VPhysicsGetObject( ),
m_Sling->VPhysicsGetObject( ), m_ConstraintGroup,
Rope1ConstraintParams);
m_Rope2Constraint =
physenv->CreateLengthConstraint(m_ArmRagdoll->VPhysicsGetObject( ),
m_Sling->VPhysicsGetObject( ), m_ConstraintGroup,
Rope2ConstraintParams);

So does anyone know how I can get the length constraint attachment on
the arm (i.e. objectPosition[0]) to follow the arm as it rotates?


_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to