Skip to content
Snippets Groups Projects
Commit 2c5a1869 authored by David Gilbert's avatar David Gilbert :bug:
Browse files

- lens collision now scales correctly with radius/thickness

- grid snapping ghost also updates scale correctly
parent bd67d0b7
Branches
No related tags found
No related merge requests found
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -258,6 +258,8 @@ void UOptiXLensComponent::SetThickness(float Thickness)
UE_LOG(LogTemp, Display, TEXT("Setting Thickness: %f"), Thickness);
LensThickness = Thickness;
QueueOptiXContextUpdate();
if(IsInGameThread())
OnLensThicknessChanged.Broadcast(LensThickness);
}
float UOptiXLensComponent::GetThickness() const
......@@ -296,6 +298,8 @@ void UOptiXLensComponent::SetLensRadius(float Radius)
UE_LOG(LogTemp, Display, TEXT("Setting Lens Radius: %f"), Radius);
LensRadius = Radius;
QueueOptiXContextUpdate();
if (IsInGameThread())
OnLensRadiusChanged.Broadcast(Radius);
}
float UOptiXLensComponent::GetLensRadius() const
......
......@@ -485,18 +485,18 @@ void ASelectableActorBase::SetRodPosition(FVector TablePosition)
// TODO Material highlighting - swap material slots?
void ASelectableActorBase::OnOverlapBegin(UPrimitiveComponent * OverlapComponent, AActor * OtherActor, UPrimitiveComponent * OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult & SweepResult)
{
int32 N = OverlapComponent->GetNumMaterials();
for (int32 i = 0; i < N; i++)
{
Cast<UMaterialInstanceDynamic>(OverlapComponent->GetMaterial(i))->SetVectorParameterValue("Color", FLinearColor(0.5, 0.5, 0.8));
}
//int32 N = OverlapComponent->GetNumMaterials();
//for (int32 i = 0; i < N; i++)
//{
// Cast<UMaterialInstanceDynamic>(OverlapComponent->GetMaterial(i))->SetVectorParameterValue("Color", FLinearColor(0.5, 0.5, 0.8));
//}
}
void ASelectableActorBase::OnOverlapEnd(UPrimitiveComponent* OverlappedComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex)
{
int32 N = OverlappedComp->GetNumMaterials();
for (int32 i = 0; i < N; i++)
{
Cast<UMaterialInstanceDynamic>(OverlappedComp->GetMaterial(i))->SetVectorParameterValue("Color", FLinearColor(0.4, 0.4, 0.4));
}
//int32 N = OverlappedComp->GetNumMaterials();
//for (int32 i = 0; i < N; i++)
//{
// Cast<UMaterialInstanceDynamic>(OverlappedComp->GetMaterial(i))->SetVectorParameterValue("Color", FLinearColor(0.4, 0.4, 0.4));
//}
}
......@@ -8,6 +8,9 @@
#include "OptiXLensComponent.generated.h"
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnLensRadiusChanged, float, Radius);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnLensThicknessChanged, float, Thickness);
/**
* Lens Type Enum
*/
......@@ -122,6 +125,13 @@ public:
UFUNCTION()
void OnWavelengthChangedEvent(float WL);
// Event callbacks:
UPROPERTY(BlueprintAssignable, Category = "OptiXLensComponent")
FOnLensRadiusChanged OnLensRadiusChanged;
UPROPERTY(BlueprintAssignable, Category = "OptiXLensComponent")
FOnLensThicknessChanged OnLensThicknessChanged;
public:
// Lens Properties
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment