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);
|
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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user