Character Rotation Mismatch - Character vs Anim Blueprint

Problem:

  • in Character Blueprint I rotate the character with Set Actor Rotation in tick
  • in Animation Blueprint, I get a reference to character, get Actor Rotation

The character rotates correctly but the rotation in Animation Blueprint is identity and does not correspond to actual character rotation. Why is that?

Hey @badziubadziu!

Would you mind sharing a screenshot of the Event Graph of your ABP? That’d be really helpful to clear things up.

Do you save the actor’s rotation one time inside a variable? Or do you pull the rotation out of your character reference?

The BP is a bit hairy to post in full.

In Character Event Tick I calculate desired direction and call Set Actor Rotation. This works and can be seen visually.

In Animation Blueprint, in Event Update Animation, I call Get Actor Rotation on stored reference (or Get Owning Actor, I tried both). I draw debug arrow for both directions (one in Character Blueprint and one obtained from Get Actor Rotation in AnimBP) and can see that character one is correct (aligned with character rotation) and Anim BP is identity (pointing +Y) and unchanging.

This was need to calculate locomotion angle for blendspace. I eventually just calculate it in Character Blueprint and access it in AnimBP to pass it on to blendspace. This works and might just be a better solution overall.

I am just curious why is the rotation not reflected in Animation Blueprint.

You only need to share the related parts of your ABP’s Event Graph. It’d be amazing if we could see that.

However I can still mention one more thing before seeing it. Are you casting to the base character class to get your characer reference by any chance? You should cast to MyExampleCharacter_BP, not to Character.

If that’s not it though, get back to us with a screenshot :blush:


Oh btw, for this purpose:

No, it wouldn’t be better to spread the logic in between multiple blueprints if it’s only gonna be used in one. If you like it that way though, of course you can! But I’d recommend handling your leaning intensity calculation inside the ABP.

Hope this helps! :innocent:

Ok, to isolate the issue I’ve made the simplest possible set of blueprints from scratch with some debugging.

Here is character blueprint

It simply calculates direction vector from actor to mouse hit on the ground plane. We draw debug arrow in green showing that direction. Then we update actor rotation accordingly.

This works as expected

Animation blueprint simply plays idle animation. In update animation event I get the rotation and draw pink arrow to see it visually.

The result

You can see pink arrow pointing 0,1,0 (default rotation not updated)

Casting to character blueprint is not relevant here because we only use default methods on base actor classes and do not need to access custom properties.