grab ray trace

This commit is contained in:
Tyrel Souza 2018-02-19 23:34:33 -05:00
parent e6968e3d0a
commit ca7164edd4
3 changed files with 17 additions and 14 deletions

Binary file not shown.

View File

@ -31,7 +31,7 @@ void UGrabber::TickComponent(float DeltaTime, ELevelTick TickType, FActorCompone
{
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
// Get player View point in this tick
/// Get player View point in this tick
FVector PlayerViewpointLocation;
FRotator PlayerViewpointRotation;
GetWorld()->GetFirstPlayerController(
@ -53,23 +53,26 @@ void UGrabber::TickComponent(float DeltaTime, ELevelTick TickType, FActorCompone
5.0f
);
//UE_LOG(LogTemp,
// Warning,
// TEXT("Location: %s Rotation: %s"),
// *PlayerViewpointLocation.ToString(),
// *PlayerViewpointRotation.ToString()
//);
///Setup Query Parameters
FCollisionQueryParams TraceParameters(FName(TEXT("")), false, GetOwner());
//UE_LOG(LogTemp,
// Warning,
// TEXT("LineTraceEnd: %s"),
// *LineTraceEnd.ToString()
//);
/// Line-Trace (Ray-Cast) out to reach distance
FHitResult Hit;
GetWorld()->LineTraceSingleByObjectType(
OUT Hit,
PlayerViewpointLocation,
LineTraceEnd,
FCollisionObjectQueryParams(ECollisionChannel::ECC_PhysicsBody),
TraceParameters
);
// Ray-Cast out to reach distance
AActor* ActorHit = Hit.GetActor();
if (ActorHit) {
UE_LOG(LogTemp, Warning, TEXT("Line Tract Hit: %s"), *(ActorHit->GetName()));
}
// See what we hit
/// See what we hit