OK, I’m totally stumped. Wnile my FConstraintInstance obviously works, as it accepts i.e. SetAngularSwing1Limit or SetLinearXMotion, the motors don’t seem to be doing anything. The connected bodies can be moved using AddForce.
Obviously I must be doing something wrong. But what?
My attempt at linear motor:
| controlledJoint->SetLinearDriveParams(HoldPositionSpring, HoldPositionDamper, HoldPositionMaxForce); | ||
|---|---|---|
| controlledJoint->SetLinearPositionTarget(controllerLocation); | ||
| controlledJoint->SetLinearPositionDrive(true, true, true); |
my attempt at angular motor:
FVector v(jointDriveXTarget, jointDriveYTarget, jointDriveZTarget);
// Set the angular drive mode
controlledJoint->SetAngularDriveMode(EAngularDriveMode::TwistAndSwing);
// Set the angular drive's strength parameters Function for setting angular motor parameters.
controlledJoint->SetAngularDriveParams(HoldRotationSpring, HoldRotationDamper, HoldRotationMaxForce);
// Set the angular drive's orientation target Function for setting target angular position.
controlledJoint->SetAngularOrientationTarget(FQuat::MakeFromEuler(v));
And the constraints:
joint->SetAngularTwistLimit(EAngularConstraintMotion::ACM_Limited, 10);
joint->SetLinearXMotion(ELinearConstraintMotion::LCM_Locked);
Can anybody help?