I’m trying to update my character’s position at the end of an animation montage using a socket location, but it’s not working as expected. Here’s my setup:
Animation Blueprint:
AnimNotify_UpdatePosition at the end of the montage
Character Blueprint:
Custom event triggered by AnimNotify_UpdatePosition
Get Socket Location (Socket: “CameraSocket”)
Transform Location (from Component to World Space)
Set Actor Location with the transformed location
Issues:
Character doesn’t move to the new position(sometimes at the end of the montage, if the character collides with a collision it resets the character forward into the x-axis or backward into the x-axis and few times it land the character on the expected location )
Print String shows new location values, but no visible change
Tried enabling Sweep and Teleport in Set Actor Location
Troubleshooting steps:
Verified “CameraSocket” exists on the skeleton
Checked for root motion in the animation
Printed current location, socket location (raw and transformed), and final location
Questions:
What could prevent the character from moving despite correct location values?
Are there any common pitfalls with updating character position this way?
How can I further debug this issue?
Any insights or suggestions would be greatly appreciated. Thanks!
If this was in multiplayer I would say that the server is correcting you back.
Other than that, are you sure the AnimNotify is hit. I’ve heard that if it is too close to the end of the animation it can be “blended out” but I’ve never experienced it. (might not be true)
To exclude any errors in the location calculation:
Can you try just hardcoding the New Location in Set Actor Location to something silly like (0,0,500)? Does it teleport you there reliably? It should. (teleport somewhere in the air so you can retest)
i connected the GetSocketLocation Return Value to drawDebugSphere
and during the running the sphere was updating but the moment the AnimMontage starts playing it stops
How do you start the whole thing? How do you play that montage? I think just calling play on a montage disables the animation blueprint state machine for the duration. Now why do you loose the socket then - no idea.
Edit:
Also, can you not call Get Owning Actor… On Event Blueprint Initialize Animation you should already have your character and movement components casted to the correct class and stored in BP variables. (That is if you started with any of the starter project animation blueprints)
Actually, you know what - just call some function on your character directly from the AnimNotify and move all the logic for the displacement there. (you will have to do it at some point anyway in order for the networking to work)
so i created an actor and linked the root bone to the actor by copying it transformation
then when I used it on the animation blueprint it kinda worked I added the video
and I also took my notifier away from the animation end
have successfully moved the function to the BPcharacter
but still got the issue
The character was restored to its previous location before the AnimMontage started
after moving my Notifier to the center of the montage animationBP, I noticed that the location quickly updates to the AnimMontage but later goes back
CHARACTERBP
It is not a law but is a good practice to keep your character movement in the character. As decoupled the BPs are from one another, the better.
You should probably open and see the animation BP in some of the starting projects. Especially if you are new to blueprints.
That being said this behavior is quite strange for a singlepalyer game.
Can you try it with the command line p.NetShowCorrections turned on just in case?
Also, make sure there is no other place where you set the location of the actor?
settings or node and did you check the video I uploaded, I have moved everything to the characterBP except for the trigger event, which happens on the animationBP and then calls the UpdatePlayerPosition function I created in the characterBP
Ok. I found your problem but I won’t be able to fix it for you. It’s in your animation.
You want to move your character through your animation. (this is called root motion) However, in your the actual animation asset the root bone doesn’t move:
This is why in your game when you make the move your capsule stays in place:
After you fix your animation (make the root to move with the character), re-import and enable RootMotion it in the animation asset, it should work.
Let me know if it does
P.S:
The other way to do this is to keep the animation “in place” and move your character procedurally, similar to how the default jump works. However, this move is much more complex and you’ll have to know exactly how you want the character to behave in the air.
Also here is another person with exactly the same problem:
unreal wants the BoneObject to have the transformation and not the root bone itself
so am transferring the root bone location animation from my root bone to the BoneObject
so first i created a rig with root bone and transfer all my animation to it(that didn’t work because I created a bone named root and parented the hips bone to it then move all the root motion to it)
secondly i named the bone object to Root and copy all the root motion to the bone object(this kind of works, but with lots of errors)
so, i got really frustrated and exported the unreal engine character with its Rig(then i created a basic animation, and when i check its rig i noticed the parent bone is the hips and the bone object is named Root i open it unreal, and the capsule follows the animation)
so, with that I hurriedly rig my character with unreal engine bone structure(and transferred the animation to it and it works but a new problem was discovered the root motion Z-axis is Ignored, so my capsule does not move it Z-location)
I used Blender with AutoRigPro
Will the capsule follow if I animate my hip bones on the Z-axis?
Yea, I know. I’ve never been good at rigging myself. Unreal wants the character skeleton setup in a particular way.
Yes, however there is code in your character movement component that “glues” your character to the floor while walking/running. Can you change the movement mode to flying and try again.