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); Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
// Get player View point in this tick /// Get player View point in this tick
FVector PlayerViewpointLocation; FVector PlayerViewpointLocation;
FRotator PlayerViewpointRotation; FRotator PlayerViewpointRotation;
GetWorld()->GetFirstPlayerController( GetWorld()->GetFirstPlayerController(
@ -53,23 +53,26 @@ void UGrabber::TickComponent(float DeltaTime, ELevelTick TickType, FActorCompone
5.0f 5.0f
); );
//UE_LOG(LogTemp, ///Setup Query Parameters
// Warning, FCollisionQueryParams TraceParameters(FName(TEXT("")), false, GetOwner());
// TEXT("Location: %s Rotation: %s"),
// *PlayerViewpointLocation.ToString(),
// *PlayerViewpointRotation.ToString()
//);
//UE_LOG(LogTemp, /// Line-Trace (Ray-Cast) out to reach distance
// Warning, FHitResult Hit;
// TEXT("LineTraceEnd: %s"),
// *LineTraceEnd.ToString()
//);
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