mirror of
https://github.com/sinbad/StevesUEHelpers.git
synced 2025-02-23 17:45:23 +00:00
Add ability to VLOG what spring arm is occluded from
This commit is contained in:
parent
84e4560cde
commit
7127c9e729
@ -1,6 +1,10 @@
|
|||||||
|
|
||||||
#include "StevesSpringArmComponent.h"
|
#include "StevesSpringArmComponent.h"
|
||||||
|
|
||||||
|
#include "StevesUEHelpers.h"
|
||||||
|
|
||||||
|
// Set this to 1 to VLOG where camera is being occluded from
|
||||||
|
#define ENABLE_VLOG_CAMERA_OCCLUSION 0
|
||||||
|
|
||||||
UStevesSpringArmComponent::UStevesSpringArmComponent()
|
UStevesSpringArmComponent::UStevesSpringArmComponent()
|
||||||
{
|
{
|
||||||
@ -12,6 +16,24 @@ FVector UStevesSpringArmComponent::BlendLocations(const FVector& DesiredArmLocat
|
|||||||
bool bHitSomething,
|
bool bHitSomething,
|
||||||
float DeltaTime)
|
float DeltaTime)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#if ENABLE_VLOG_CAMERA_OCCLUSION
|
||||||
|
#if ENABLE_VISUAL_LOG
|
||||||
|
if (bHitSomething)
|
||||||
|
{
|
||||||
|
FVector NewDesiredLoc = PreviousDesiredLoc - PreviousDesiredRot.Vector() * TargetArmLength;
|
||||||
|
// Add socket offset in local space
|
||||||
|
NewDesiredLoc += FRotationMatrix(PreviousDesiredRot).TransformVector(SocketOffset);
|
||||||
|
FCollisionQueryParams QueryParams(SCENE_QUERY_STAT(SpringArm), false, GetOwner());
|
||||||
|
FHitResult Result;
|
||||||
|
if (GetWorld()->SweepSingleByChannel(Result, PreviousArmOrigin, NewDesiredLoc, FQuat::Identity, ProbeChannel, FCollisionShape::MakeSphere(ProbeSize), QueryParams))
|
||||||
|
{
|
||||||
|
UE_VLOG_ARROW(this, LogStevesUEHelpers, Log, PreviousArmOrigin, Result.Location, FColor::Cyan, TEXT(""));
|
||||||
|
UE_VLOG_LOCATION(this, LogStevesUEHelpers, Log, Result.Location, ProbeSize, FColor::Cyan, TEXT("%s"), *Result.GetActor()->GetActorNameOrLabel());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
// These locations are in world space, we only want to blend the arm length, not the rest
|
// These locations are in world space, we only want to blend the arm length, not the rest
|
||||||
const FVector Base = Super::BlendLocations(DesiredArmLocation, TraceHitLocation, bHitSomething, DeltaTime);
|
const FVector Base = Super::BlendLocations(DesiredArmLocation, TraceHitLocation, bHitSomething, DeltaTime);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user