Download

Character aim offsets off by frame

I have my character’s aim offsets all set up correctly but it seems like my anim event graph is running before the character’s actual controller aim update, so it’s always behind by a frame from where my camera is looking at.

I can’t find an example of anyone else having this problem. Is there anything I need to do to ensure all the aiming is updated before the animation is updated during a tick?

Bumping up. Still unsolved…

I think PlayerController aim rotation code is run way later in the game tick after the animation.

I tried messing around with Adding the player controller as a prerequisite actor to the Character and Mesh in the Possess method but that didn’t seem to help.

I have a couple of aim offset tests set up and I do not -think- I’m seeing this, but maybe I’m misunderstanding the issue. Please provided repro steps to follow so I can create the issue here. For instance, what, if any template are you using? What documentation, vid tutorial, etc are you following? Any additional information you can add will be helpful.

Ah well your question prompted me to write up a bunch of info about how I’m doing things and I fixed the problem by replacing a GetBaseAimRotation call with GetControlRotation and suddenly it’s working perfectly :smiley:

I’m a bit confused though why GetBaseAimRotation is off by a frame but GetControlRotation isn’t. I wonder if that is possibly a bug?

I was using this code I copied from the First Person Shooter example project.



FRotator AWRCharacter::GetAimOffsets_Implementation() const
{
	const FVector AimDirWS = GetBaseAimRotation().Vector();
	const FVector AimDirLS = ActorToWorld().InverseTransformVectorNoScale(AimDirWS);
	const FRotator AimRotLS = AimDirLS.Rotation();

	return AimRotLS;
}


Replace it with this and it works!



FRotator AWRCharacter::GetAimOffsets_Implementation() const
{
	const FVector AimDirWS = GetControlRotation().Vector();
	const FVector AimDirLS = ActorToWorld().InverseTransformVectorNoScale(AimDirWS);
	const FRotator AimRotLS = AimDirLS.Rotation();

	return AimRotLS;
}


Glad to see you found a solution and thank you for posting it here. I’m looking into why GetBaseAimRotation is off by a frame and if it is indeed a bug. If I find out the answer I will post it here.