"Allow Physics Rotation During Root Motion" In cpp

Hello, so I’m using cpp in my project but I’ve run into a beginner problem. My character is still able to partially move when i use root motion. I know how to turn it of in blueprint but im new to cpp and I cant figure out how to make this work in cpp. I’m using ALSv4, the community version, so the MovementComponent uses cpp, with the character. I’ve tried making use of the Chatgpt and Github Copilot, both gave me wrong answers wich is a bit suprising, didnt know it would be this hard for something that is so easy on blueprint. Hope I can get your help!

“Allow Physics Rotation During Root Motion” Is what im trying to do in cpp.


Untitled video - Made with Clipchamp

Hi,

In your character class, simple:

GetCharacterMovement()->bAllowPhysicsRotationDuringAnimRootMotion = false;

Do not forget to add the #include "GameFramework/CharacterMovementComponent.h"

Bye.

I tried it, but it didn’t work. It might function correctly in a standard locomotion setup, but mine isn’t exactly standard, I’m using the ALSv4 community version. While testing, I noticed that my character’s root motion behaves properly when running on a listen server (for both server and client). However, in standalone mode without a server, it doesn’t work and behaves as shown in the attached GIF.

Untitled video - Made with Clipchamp

Here is how ot should work (This is what i get when in listed server, but i want this as default, not only when listed.)

Untitled video - Made with Clipchamp (1)

Found the solution.

This is what enables rotation while rolling in ALSv4. If you remove this, it’s the same code as in the picture

SmoothCharacterRotation({0.0f, LastMovementInputRotation.Yaw, 0.0f}, 0.0f, 2.0f, DeltaTime);

it’s located inside the

void AALSBaseCharacter::UpdateGroundedRotation(float DeltaTime)

it makes the character roll without rotation both standalone and networked.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.