Download

Root Motion does not work on spawned actor

Hi,

I have a weird issue. I have created a blueprint class inherited from A Character and this char moves using root motion. If I put this blueprint into level manually it works properly but if I spawn an instance of this blueprint from code using GetWorld()->SpawnActor<> root motion doesn’t work. Walk animation is playing but character does not move.

Any idea??

thanks

I have the very same issue you got, have you solved?

Did you attach the actor after you spawned in? You have to attach or it will just sit at the x,y,z position you spawned in.

MeleeWeapon = GetWorld()->SpawnActor<AWardSword>(BPMeleeWeapon, FVector(), FRotator());

like this:
MeleeWeapon->AttachToActor(this, FAttachmentTransformRules::KeepRelativeTransform, “RightHandSocket”);

or if no socket:
MeleeWeapon->AttachToActor(this, FAttachmentTransformRules::KeepRelativeTransform);

https://docs.unrealengine.com/en-US/…tor/index.html

Have you tried UAnimInstance::SetRootMotionMode?

Hey I just came across this and was having a similar issue kind of… Trying to spawn HUD widget to a root motion based character… Instead of using “EventBeginPlay” I used The :“event Tick” event with a sequence node off of it and got the widget to display properly without it messing up my character movement…Now i just cannot seem to get my weapon to spawn to my character… hopefully my Images help someone… took me like 5 hours to figure it out accidentally lol.