My best guess from looking at the code is that m_ArmRagdoll->VPhysicsGetObject() is not returning a pointer to the correct piece of that ragdoll. You can use VPhysicsGetObjectList() to get all of the arm's pieces and then pick the one with the correct index by asking each object GetGameIndex().
UpdateRagdollTransform() is for animating the relative transform between the two objects attached by the ragdoll constraint. It doesn't sound like what you are looking for. The other thing that looks suspect is the RopeHookAttach code. Are you sure that the RopeHook model attachment is attached to the same bone as the physics you intend to constrain? Pass it through the arm ragdoll object's LocalToWorld() and draw a debug overlay cross/box there. Is it where you expect? Jay > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > Greg "Monder" Chadwick > Sent: Thursday, May 26, 2005 6:38 AM > To: [email protected] > Subject: [hlcoders] Ragdolls and Constraints > > 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 > > _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders

