force the wrist tracker to track the right hand on init/begin/construct

This commit is contained in:
Mamadou Babaei
2023-03-28 10:37:56 +02:00
parent 1340bc875c
commit d962804a49
4 changed files with 24 additions and 2 deletions
@@ -141,6 +141,14 @@ void ASGPawn::BeginPlay()
});
}
void ASGPawn::PreInitializeComponents()
{
Super::PreInitializeComponents();
WristTrackerLeft->SetRight(HandLeft->IsRight());
WristTrackerRight->SetRight(HandRight->IsRight());
}
ASGPawn::FImpl::FImpl(ASGPawn* InOwner)
: Owner(InOwner)
{
@@ -151,4 +159,4 @@ ASGPawn::FImpl::~FImpl() = default;
void ASGPawn::FImplDeleter::operator()(const FImpl* P) const
{
delete P;
}
}
@@ -87,6 +87,8 @@ ASGVirtualHandActor::ASGVirtualHandActor(const FObjectInitializer& ObjectInitial
WristTracker = CreateDefaultSubobject<USGWristTrackerComponent>(TEXT("WristTracker"));
WristTracker->SetupAttachment(RootComponent);
WristTracker->SetRight(VirtualHand->IsRight());
}
void ASGVirtualHandActor::BeginPlay()
@@ -142,9 +144,18 @@ bool ASGVirtualHandActor::ShouldTickIfViewportsOnly() const
return false;
}
void ASGVirtualHandActor::PreInitializeComponents()
{
Super::PreInitializeComponents();
WristTracker->SetRight(VirtualHand->IsRight());
}
void ASGVirtualHandActor::OnConstruction(const FTransform& Transform)
{
Super::OnConstruction(Transform);
WristTracker->SetRight(VirtualHand->IsRight());
}
void ASGVirtualHandActor::EditorTick(float DeltaSeconds)
@@ -108,4 +108,5 @@ public:
public:
virtual void BeginPlay() override;
};
virtual void PreInitializeComponents() override;
};
@@ -101,6 +101,8 @@ public:
virtual bool ShouldTickIfViewportsOnly() const override;
virtual void PreInitializeComponents() override;
virtual void OnConstruction(const FTransform& Transform) override;
protected: