LockedAxisMode Has No Effect in C++

I am trying to constrain physics. In blueprint it works fine but I can’t get it to work in C++.

I have a USphereComponent that I’m creating:

UPROPERTY()
TSubobjectPtr<USphereComponent> CollisionComp;

And initializing:

CollisionComp = PCIP.CreateDefaultSubobject<USphereComponent>(this, TEXT("SphereComp"));	
RootComponent = CollisionComp;

And configuring the physics state:

CollisionComp->SetSimulatePhysics(true);
CollisionComp->InitSphereRadius(0.01f);		
CollisionComp->BodyInstance.bUseCCD = true;
CollisionComp->BodyInstance.LockedAxisMode = ELockedAxis::Y;
CollisionComp->SetEnableGravity(false);

The only thing that isn’t working is the locked axis. Am I missing a step somewhere?

The LockedAxisMode stuff is all performed as part of the initialization for the FBodyInstance that is part of the USphereComponent (and other shapes).
In 4.5 and earlier, you can force the locked axis mode to update by re-calling the DOF Lock initializer, for instance:

CollisionComp->BodyInstance.LockedAxisMode = ELockedAxis::Y;
CollisionComp->BodyInstance.CreateDOFLock();

There was a recent patch that adds a new setter function that does exactly the same thing. It will probably be in 4.6:

CollisionComp->BodyInstance.SetLockedAxis(ELockedAxis::Y);