Hi everyone, I’m trying to rotate my mesh to face the direction my pawn/actor will be facing in. My problem is that due to an animation, I have to freeze the mesh in place so the actor’s ai perception component rotates while the mesh does not (the animation is a head swivel while the body stays in place). The problem is that if the animation is interrupted by the actor seeing something, I need to return the mesh back to facing the same direction the actor/pawn is facing. I froze the mesh using the world rotation of the child actor, so I tried to set it back to facing forward by doing this:
But it doesn’t seem to work. Setting the mesh rotation to the getactorrotation node does not work either. What am I doing wrong?
Hello,
Okay, simplify this for me. What, EXACTLY, is it you are trying to do (without all of the program jargon)?
Is it that you have an enemy that is patrolling and they stop to look around? And if their body is not facing the character during detection, you want them to then turn around and pursue the player character?
Yes, but specifically, I need the mesh on the enemy to first face the same direction as their other components before I can rotate the actor towards the player as a whole. But I can’t seem to get the mesh to face the same direction as the pawn.
Can you post a photo of your character’s component hierarchy in its blueprint?
I’m not sure you’re going about this the best way. Maybe you are, but it seems over-complicated.
This is what I’d like to see:
Also a video and shots of your blueprint would be VERY helpful.
This is the hierarchy:
The animation is just the head turning as shown below:
I need the ai perception component to rotate, but if I rotate just the actor, the mesh also rotates, messing up the animation. So I decided to freeze the mesh in place (like in the video). But if the guard sees the player, the mesh does not snap back in the same direction as the actor and we get something like this:
I forgot to include this but this timeline is called every instance the guard turns:
And this is the mesh rotation function:
Okay, this helps quite a bit.
Instead of rotating the entire character, try rotating the SphereLight. The SenseSphere is a child of it, so as it rotates, the Mesh should not rotate. This should also allow you to not have the freeze the entire actor, and continue playing the animation.