I’ve been trying to familiarize myself with mover, specifically the chaos mover part, so do let me know if I have just not completed any important and obvious step, but from what I can tell, crouching with the physics mover has a couple of `visual` and state sync issues.
I’ve managed to get the actual crouch to work on chaos mover, by following the source code, since crouch for the physics pawn isn’t in the mover examples. At first I thought this wasn’t working at all because the anim bp I used wasn’t setup for crouching, and I was relying on seeing the capsule shrink, whether via making it visible or with `Show Collision`.
But then as I dug around the code and realized that everything was firing and executing correctly on the physics thread, I realized that I can actually go under low collision, higher than the half height *2 + ground clearance. And after that, I confirmed with ChaosVisualDebugger that everything is indeed working as intended.
It was just that the capsule component on the game thread, recieves no updates to its radius/height or world location when the crouch stance modifier gets enabled. But the physics particle is correct.
I double checked if the game thread actually receives the data chaos mover sends by writing a little helper:
And this confirmed my suspicion, which was that the game thread does receive the updated particle, because I also tried tracing on the game thread against the play, to see if the trace results change between crouch and standing, and they do.
So I believe that a sync point which modifies the actual UCapsuleComponent and its member data to match the new capsule shape is missing.
However, I suspect fixing this only on the game thread side is impossible, as that would perhaps lead to desyncs.
Contrary to how crouch works in the CMC or the regular mover, this physics pawn crouch, re-pivots the capsule as a physics shape, without touching the owner’s location, meaning the capsule is no longer pivoted at the center, at least in the physics world. The getter code snipped can also show that. And here is basically where I stopped trying to figure out how to fix this myself and thought I’d open this ticket. Because the game thread cant support this concept, since the capsule is the root component, so a non central pivot isn’t supported.
And so I am curious how this will be addressed, since the actual implementation of crouch here is very nice, not changing the base location, and shifting the capsule down is a very clean way to resolve the traditional CMC crouch issues, where you effectively crouch mid air, begin falling and rely on the snap to ground to roughly make it a smooth transition, where as here, everything is very stable, and its up to the pawn to tackle the visual re-presentation. The caveat here is that this representation is impossible for the game thread.
For now, the code snippet provides enough info for a draw debug capsule to replace the visualization during development.
void UMyProjectFunctionLibrary::GetCapsuleFromPhysicsThread(UCapsuleComponent* CapsuleComponent, float& CapsuleRadius,
float& CapsuleHalfHeight, FVector& CapsuleCenter)
{
FVector CapsuleExtents = FVector::ZeroVector;
CapsuleComponent->BodyInstance.GetBodyBoundsLocal().GetCenterAndExtents(CapsuleCenter, CapsuleExtents);
CapsuleCenter = CapsuleComponent->GetComponentLocation() + CapsuleCenter;
CapsuleHalfHeight = CapsuleExtents.Z;
CapsuleRadius = CapsuleExtents.X;
}
[Attachment Removed]