Skip to content
Snippets Groups Projects
Commit 631538d5 authored by Lab1's avatar Lab1
Browse files

remove second default values (in initialize parameters) and scale ray in...

remove second default values (in initialize parameters) and scale ray in beginplay (when the values are actually set)
parent 4a7be9f6
Branches
No related tags found
No related merge requests found
Pipeline #241603 failed
......@@ -41,7 +41,8 @@ void UBasicVRInteractionComponent::BeginPlay()
Super::BeginPlay();
//WidgetInteractionComponent
// InteractionDistance = MaxClickDistance;
InteractionDistance = MaxClickDistance;
InteractionRay->SetRelativeScale3D(FVector(MaxClickDistance / 100.0f, 0.5f, 0.5f)); //the ray model has a length of 100cm (and is a bit too big in Y/Z dir)
SetInteractionRayVisibility(InteractionRayVisibility);
}
......@@ -195,16 +196,13 @@ void UBasicVRInteractionComponent::TickComponent(float DeltaTime, ELevelTick Tic
LastActorHit = HitActor; // Store the actor that was hit to have access to it in the next frame as well
}
void UBasicVRInteractionComponent::Initialize(USceneComponent* RayEmitter, float InMaxGrabDistance, float InMaxClickDistance)
void UBasicVRInteractionComponent::Initialize(USceneComponent* RayEmitter)
{
if(InteractionRayEmitter) return; /* Return if already initialized */
InteractionRayEmitter = RayEmitter;
MaxGrabDistance = InMaxGrabDistance;
MaxClickDistance = InMaxClickDistance;
InteractionRay->AttachToComponent(RayEmitter, FAttachmentTransformRules::KeepRelativeTransform);
InteractionRay->SetRelativeScale3D(FVector(MaxClickDistance/100.0f, 1.0f, 1.0f)); //the ray model has a length of 100cm
this->AttachToComponent(RayEmitter, FAttachmentTransformRules::KeepRelativeTransform);
}
......
......@@ -42,7 +42,7 @@ public:
UPROPERTY(EditAnywhere) bool bCanRaytraceEveryTick = false;
UPROPERTY(EditAnywhere) TEnumAsByte<EInteractionRayVisibility> InteractionRayVisibility = EInteractionRayVisibility::Invisible;
UFUNCTION(BlueprintCallable) void Initialize(USceneComponent* RayEmitter, float InMaxGrabDistance = 50, float InMaxClickDistance = 500);
UFUNCTION(BlueprintCallable) void Initialize(USceneComponent* RayEmitter);
UFUNCTION(BlueprintCallable, BlueprintPure) AActor* GetGrabbedActor() const { return GrabbedActor;}
UFUNCTION(BlueprintCallable, BlueprintPure) USceneComponent* GetInteractionRayEmitter() const { return InteractionRayEmitter; }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment