[Bug Fix Quickie] - Constraints / Joints not working in C++ (Randomly breaking)

FConstraintInstance ueses bitfield packing for initializing some values. However, this seems to not work at all. (Honestly, I don’t have a clue about what it actually even does, but…) Whereas Swing-values all get their value overriden in the constructor of FConstraintInstance, bLinearBreakable and bAngularBreakable are not initialized in the constructor and randomly switch between true and false, leading to constraints that randomly work and randomly just fall apart.

Quick Fix: Just initialize the values manually with

FConstraintInstance instance;
instance.bLinearBreakable = true/false;
instance.bAngularBreakable = true/false;


PS.:I wrote the Title as a bug question so other people are more likely to find this thread with googleing their issue)
PPS.: How many Bug Fixes does it take to become a Engine Contributor? :rolleyes::stuck_out_tongue:
PPPS.: I already wrote a bug-report to the answerHub, so no need for anyone to do it :slight_smile:
PPPPS.: I’m happy… 4 days of work finally pay off

Thanks for this, I am probably going to move some of my constraint stuff into C++ soon and would have probably wasted a lot of time dealing with this.

Just like me haha. The problem was that I first just wanted to test constraints and only used Rama’s Wiki Code since it is really the only documentation about Constraints in C++, therefore I just initialized some test-Values and didn’t care about default values I didn’t set. Actually costed my 2 weeks since I thought I’m too stupid for this and moved on to another solution (that didn’t work either)