Hey guys. I have a little thing I am fiddling with which lets you lock objects rotation while stacking them on top of one another. In code I do this:
MainModel->BodyInstance.bLockXRotation = true;
MainModel->BodyInstance.bLockYRotation = true;
But that doesn’t seem to do it. When I eject and look at the object it has the locked axis checked but behaves as if they are not. If I uncheck and then recheck again while still in PIE mode, it works as expected. Is there something I need to do to apply physics changes in C++ code for it to realize that these have changed or is it a bug?
To clarify, I have a bunchof Blueprints which contain a single StaticMesh each, which has physics turned on. When they are not axis locked they will tumble and roll as intended, and when they are I expect them not to. Setting the locks before entering PIE (using the inspector panel on the right or in the BP editor) works fine. Toggling in C++ does not, even though the boxes get checked. I have to eject from my player pawn, select the object, toggle the checkboxes off and back on again and then repossess my player and it works fine.