Getting the Forward Vector of a Parent Actor

I’m currently attempted to create a laser beam that will shoot out of this boss that I have, following with it’s rotation but currently I can’t seem to get it to follow the rotation.


The Boss will always look at the player as shown in the Image above, with the red lines being where the laser is meant to be following but as you see, they’re not actually working with the bosses rotation, they should be pointing directly at the player while coming from the middle of the iris of the eyeball.

This is my code for creating the raycast that I’m using:

void ALaserBeam::CastRaycast()
	FHitResult* hit = new FHitResult();
	FVector startTrace = laserStart;
	FVector forwardVector = GetParentActor()->GetActorForwardVector();
	FVector endTrace = ((forwardVector * 5000.0f) * startTrace);
	FCollisionQueryParams* traceParms = new FCollisionQueryParams();

	if (GetWorld()->LineTraceSingleByChannel(*hit, startTrace, endTrace, ECC_Visibility, *traceParms))
		DrawDebugLine(GetWorld(), startTrace, endTrace, FColor::Red, true);


The reason I’m doing “GetParentActor()->GetActorForwardVector();” for the Forward Vector variable is cause the laser beam is currently a component of the boss so I want it to get the bosses forward vector instead of it’s own (Though I imagine it would work either way as it should rotate with the boss). However as you see, this doesn’t work and I’m not really sure how to get it working.

Can anyone help? I’d very much appreciate it

This line FVector endTrace = ((forwardVector * 5000.0f) * startTrace);

Should be FVector endTrace = ((forwardVector * 5000.0f) + startTrace);

add a UArrowComponent to the boss and attach it to his head along his sight.

then get arrow forward vector whenever you need boss forward vector.