Ray Cast only shoots in one direction...


So this works in the FPS shooter tutorial.

But when I transfer code to my project…

	AMyPlayerController* myPC = Cast<AMyPlayerController>(this->GetController());
	const FVector StartServer = myPC->GetFocalLocation();
	const FVector EndServer = StartServer + GetControlRotation().Vector() * 1000;

what I want to do is shoot a ray cast to where the pawn is looking at. The nose of the pawn. I have a invisible scene component sitting at the nose of the turret.

The video describes the problem…

You can see the starting point is fine.

The end point, well…

The Player Controller contains no logic for now. The Server just tells the player to posses a Pawn that’s been sppawned.

Any ideas?

Im a bit unclear as to what you actually want but you can use GetActorForwardVector() to get a vector of where the pawn is looking, then multiply that by a value to get further in front of the pawn (it’s nose).

Without seeing the actual raycast (trace) code it’s hard to see where you went wrong.