grab ray trace
This commit is contained in:
parent
e6968e3d0a
commit
ca7164edd4
Binary file not shown.
Binary file not shown.
@ -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
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user