So I have an object that inherits from KActor that I would like to behave as a dynamic physics object, but I want its Z-Axis to remain upright, but very stiffly. I've tried the bStayUpright that triggers the "Stay Upright Spring". The problem is, it's a spring, and the object in question oscillates into position when I want it to remain oriented properly without wobbling.


In the image above, the yellow block has fallen onto the gray box, and it is currently pivoting about the contact point as it tries to right itself.

Should I be tweaking the StayUprightMaxTorque and StayUprightTorqueFactor parameters, or should I be using a Constraint of some sort?


So we decided we wanted the wall not to rotate at all, and here is the solution:

local QuadForceKCreateBlock MeshActor;
local RB_ConstraintActor AConstraint;

MeshActor = spawn(class'QuadForceKCreateBlock', none, 'PowerCreate_Block', BlockLocation(), m_PreparedRotation, , false);

AConstraint = Spawn(class'RB_ConstraintActorSpawnable', MeshActor, '', MeshActor.Location, rot(0,0,0));
AConstraint.ConstraintSetup.bSwingLimited = true;
AConstraint.ConstraintSetup.bTwistLimited = true;
AConstraint.ConstraintSetup.LinearYSetup.bLimited = 0;
AConstraint.ConstraintSetup.LinearYSetup.bLimited = 0;
AConstraint.ConstraintSetup.LinearZSetup.bLimited = 0;
AConstraint.InitConstraint(MeshActor, None);

The ConstraintSetup defaults to having TwistLimit and SwingLimit = 0, which will allow no rotation. It also defaults to TwistLimitSoft and SwingLimitSoft false, which guarantees you don't get any motion at all.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.