Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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.

screenshot

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?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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