do not reigger OnGrabStateUpdated and OnTouchStateUpdated at all when the hand mesh is not valid or visible and also some other extra measures to make sure even if they are triggered they won't affect anything
This commit is contained in:
+1
-1
@@ -34,7 +34,7 @@ This is a minor release focusing mainly on bringing OpenXR-compatible hand track
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed a bug when the virtual hand inside the game is not visible but still have collisions with other objects inside the scene.
|
||||
- Fixed a bug when the virtual hand inside the game is not visible but still collides with other objects inside the scene, mistakenly triggering events like OnGrabStateUpdated and OnTouchStateUpdated.
|
||||
- Fix various wrong Kismet script names and their class exports.
|
||||
|
||||
### Changed
|
||||
|
||||
@@ -616,14 +616,14 @@ void USGVirtualHandComponent::FImpl::UpdateVisibility()
|
||||
bGotMotionControllerData
|
||||
&& MotionControllerData.bValid
|
||||
&& MotionControllerData.DeviceVisualType == EXRVisualType::Hand;
|
||||
const bool bIsHandVisible = Owner->GetVisibleFlag();
|
||||
const bool bHandVisible = Owner->IsVisible();
|
||||
const bool bShouldBeVisibleWhenHandDataUnavailable = Owner->IsVisibleWhenHandDataUnavailable();
|
||||
|
||||
bool bSetNewVisibility = false;
|
||||
|
||||
if (bHandDataAvailable)
|
||||
{
|
||||
if (bIsHandVisible)
|
||||
if (bHandVisible)
|
||||
{
|
||||
bSetNewVisibility = false;
|
||||
}
|
||||
@@ -634,7 +634,7 @@ void USGVirtualHandComponent::FImpl::UpdateVisibility()
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bIsHandVisible)
|
||||
if (bHandVisible)
|
||||
{
|
||||
if (bShouldBeVisibleWhenHandDataUnavailable)
|
||||
{
|
||||
|
||||
@@ -725,11 +725,24 @@ void ASGPawn::OnLeftThumbFingertipGrabColliderOverlapBegins(
|
||||
(void) bFromSweep;
|
||||
(void) SweepResult;
|
||||
|
||||
if (USGGrabComponent::IsGrabbable(OtherActor))
|
||||
if (!IsValid(LeftHandGrabState.Hand))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const bool bHandVisible = LeftHandGrabState.Hand->IsVisible();
|
||||
if (!bHandVisible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!USGGrabComponent::IsGrabbable(OtherActor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LeftHandGrabState.ActorThumbCanGrab = OtherActor;
|
||||
Pimpl->TriggerGrabStateUpdatedEvent(LeftHandGrabState);
|
||||
}
|
||||
}
|
||||
|
||||
void ASGPawn::OnLeftThumbFingertipGrabColliderOverlapEnds(
|
||||
@@ -742,11 +755,18 @@ void ASGPawn::OnLeftThumbFingertipGrabColliderOverlapEnds(
|
||||
(void) OtherComp;
|
||||
(void) OtherBodyIndex;
|
||||
|
||||
if (LeftHandGrabState.ActorThumbCanGrab == OtherActor)
|
||||
if (!IsValid(LeftHandGrabState.Hand))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (LeftHandGrabState.ActorThumbCanGrab != OtherActor)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LeftHandGrabState.ActorThumbCanGrab = nullptr;
|
||||
Pimpl->TriggerGrabStateUpdatedEvent(LeftHandGrabState);
|
||||
}
|
||||
}
|
||||
|
||||
void ASGPawn::OnLeftIndexFingertipGrabColliderOverlapBegins(
|
||||
@@ -763,11 +783,24 @@ void ASGPawn::OnLeftIndexFingertipGrabColliderOverlapBegins(
|
||||
(void) bFromSweep;
|
||||
(void) SweepResult;
|
||||
|
||||
if (USGGrabComponent::IsGrabbable(OtherActor))
|
||||
if (!IsValid(LeftHandGrabState.Hand))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const bool bHandVisible = LeftHandGrabState.Hand->IsVisible();
|
||||
if (!bHandVisible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!USGGrabComponent::IsGrabbable(OtherActor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LeftHandGrabState.ActorIndexCanGrab = OtherActor;
|
||||
Pimpl->TriggerGrabStateUpdatedEvent(LeftHandGrabState);
|
||||
}
|
||||
}
|
||||
|
||||
void ASGPawn::OnLeftIndexFingertipGrabColliderOverlapEnds(
|
||||
@@ -780,11 +813,18 @@ void ASGPawn::OnLeftIndexFingertipGrabColliderOverlapEnds(
|
||||
(void) OtherComp;
|
||||
(void) OtherBodyIndex;
|
||||
|
||||
if (LeftHandGrabState.ActorIndexCanGrab == OtherActor)
|
||||
if (!IsValid(LeftHandGrabState.Hand))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (LeftHandGrabState.ActorIndexCanGrab != OtherActor)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LeftHandGrabState.ActorIndexCanGrab = nullptr;
|
||||
Pimpl->TriggerGrabStateUpdatedEvent(LeftHandGrabState);
|
||||
}
|
||||
}
|
||||
|
||||
void ASGPawn::OnLeftMiddleFingertipGrabColliderOverlapBegins(
|
||||
@@ -801,11 +841,24 @@ void ASGPawn::OnLeftMiddleFingertipGrabColliderOverlapBegins(
|
||||
(void) bFromSweep;
|
||||
(void) SweepResult;
|
||||
|
||||
if (USGGrabComponent::IsGrabbable(OtherActor))
|
||||
if (!IsValid(LeftHandGrabState.Hand))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const bool bHandVisible = LeftHandGrabState.Hand->IsVisible();
|
||||
if (!bHandVisible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!USGGrabComponent::IsGrabbable(OtherActor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LeftHandGrabState.ActorMiddleCanGrab = OtherActor;
|
||||
Pimpl->TriggerGrabStateUpdatedEvent(LeftHandGrabState);
|
||||
}
|
||||
}
|
||||
|
||||
void ASGPawn::OnLeftMiddleFingertipGrabColliderOverlapEnds(
|
||||
@@ -818,11 +871,18 @@ void ASGPawn::OnLeftMiddleFingertipGrabColliderOverlapEnds(
|
||||
(void) OtherComp;
|
||||
(void) OtherBodyIndex;
|
||||
|
||||
if (LeftHandGrabState.ActorMiddleCanGrab == OtherActor)
|
||||
if (!IsValid(LeftHandGrabState.Hand))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (LeftHandGrabState.ActorMiddleCanGrab != OtherActor)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LeftHandGrabState.ActorMiddleCanGrab = nullptr;
|
||||
Pimpl->TriggerGrabStateUpdatedEvent(LeftHandGrabState);
|
||||
}
|
||||
}
|
||||
|
||||
void ASGPawn::OnLeftThumbFingertipTouchColliderOverlapBegins(
|
||||
@@ -839,12 +899,25 @@ void ASGPawn::OnLeftThumbFingertipTouchColliderOverlapBegins(
|
||||
(void) bFromSweep;
|
||||
(void) SweepResult;
|
||||
|
||||
if (USGTouchComponent::IsTouchable(OtherActor))
|
||||
if (!IsValid(LeftHandTouchState.Hand))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const bool bHandVisible = LeftHandTouchState.Hand->IsVisible();
|
||||
if (!bHandVisible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!USGTouchComponent::IsTouchable(OtherActor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LeftHandTouchState.ActorThumbTouching = OtherActor;
|
||||
Pimpl->TriggerTouchStateUpdatedEvent(LeftHandTouchState);
|
||||
Pimpl->TriggerBeginTouch(LeftHandTouchState.Hand, OtherActor);
|
||||
}
|
||||
}
|
||||
|
||||
void ASGPawn::OnLeftThumbFingertipTouchColliderOverlapEnds(
|
||||
@@ -857,12 +930,19 @@ void ASGPawn::OnLeftThumbFingertipTouchColliderOverlapEnds(
|
||||
(void) OtherComp;
|
||||
(void) OtherBodyIndex;
|
||||
|
||||
if (LeftHandTouchState.ActorThumbTouching == OtherActor)
|
||||
if (!IsValid(LeftHandTouchState.Hand))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (LeftHandTouchState.ActorThumbTouching != OtherActor)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LeftHandTouchState.ActorThumbTouching = nullptr;
|
||||
Pimpl->TriggerTouchStateUpdatedEvent(LeftHandTouchState);
|
||||
Pimpl->TriggerEndTouch(LeftHandTouchState.Hand, OtherActor);
|
||||
}
|
||||
}
|
||||
|
||||
void ASGPawn::OnLeftIndexFingertipTouchColliderOverlapBegins(
|
||||
@@ -879,12 +959,25 @@ void ASGPawn::OnLeftIndexFingertipTouchColliderOverlapBegins(
|
||||
(void) bFromSweep;
|
||||
(void) SweepResult;
|
||||
|
||||
if (USGTouchComponent::IsTouchable(OtherActor))
|
||||
if (!IsValid(LeftHandTouchState.Hand))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const bool bHandVisible = LeftHandTouchState.Hand->IsVisible();
|
||||
if (!bHandVisible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!USGTouchComponent::IsTouchable(OtherActor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LeftHandTouchState.ActorIndexTouching = OtherActor;
|
||||
Pimpl->TriggerTouchStateUpdatedEvent(LeftHandTouchState);
|
||||
Pimpl->TriggerBeginTouch(LeftHandTouchState.Hand, OtherActor);
|
||||
}
|
||||
}
|
||||
|
||||
void ASGPawn::OnLeftIndexFingertipTouchColliderOverlapEnds(
|
||||
@@ -897,12 +990,19 @@ void ASGPawn::OnLeftIndexFingertipTouchColliderOverlapEnds(
|
||||
(void) OtherComp;
|
||||
(void) OtherBodyIndex;
|
||||
|
||||
if (LeftHandTouchState.ActorIndexTouching == OtherActor)
|
||||
if (!IsValid(LeftHandTouchState.Hand))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (LeftHandTouchState.ActorIndexTouching != OtherActor)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LeftHandTouchState.ActorIndexTouching = nullptr;
|
||||
Pimpl->TriggerTouchStateUpdatedEvent(LeftHandTouchState);
|
||||
Pimpl->TriggerEndTouch(LeftHandTouchState.Hand, OtherActor);
|
||||
}
|
||||
}
|
||||
|
||||
void ASGPawn::OnLeftMiddleFingertipTouchColliderOverlapBegins(
|
||||
@@ -919,12 +1019,25 @@ void ASGPawn::OnLeftMiddleFingertipTouchColliderOverlapBegins(
|
||||
(void) bFromSweep;
|
||||
(void) SweepResult;
|
||||
|
||||
if (USGTouchComponent::IsTouchable(OtherActor))
|
||||
if (!IsValid(LeftHandTouchState.Hand))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const bool bHandVisible = LeftHandTouchState.Hand->IsVisible();
|
||||
if (!bHandVisible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!USGTouchComponent::IsTouchable(OtherActor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LeftHandTouchState.ActorMiddleTouching = OtherActor;
|
||||
Pimpl->TriggerTouchStateUpdatedEvent(LeftHandTouchState);
|
||||
Pimpl->TriggerBeginTouch(LeftHandTouchState.Hand, OtherActor);
|
||||
}
|
||||
}
|
||||
|
||||
void ASGPawn::OnLeftMiddleFingertipTouchColliderOverlapEnds(
|
||||
@@ -937,12 +1050,19 @@ void ASGPawn::OnLeftMiddleFingertipTouchColliderOverlapEnds(
|
||||
(void) OtherComp;
|
||||
(void) OtherBodyIndex;
|
||||
|
||||
if (LeftHandTouchState.ActorMiddleTouching == OtherActor)
|
||||
if (!IsValid(LeftHandTouchState.Hand))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (LeftHandTouchState.ActorMiddleTouching != OtherActor)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LeftHandTouchState.ActorMiddleTouching = nullptr;
|
||||
Pimpl->TriggerTouchStateUpdatedEvent(LeftHandTouchState);
|
||||
Pimpl->TriggerEndTouch(LeftHandTouchState.Hand, OtherActor);
|
||||
}
|
||||
}
|
||||
|
||||
void ASGPawn::OnLeftRingFingertipTouchColliderOverlapBegins(
|
||||
@@ -959,12 +1079,25 @@ void ASGPawn::OnLeftRingFingertipTouchColliderOverlapBegins(
|
||||
(void) bFromSweep;
|
||||
(void) SweepResult;
|
||||
|
||||
if (USGTouchComponent::IsTouchable(OtherActor))
|
||||
if (!IsValid(LeftHandTouchState.Hand))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const bool bHandVisible = LeftHandTouchState.Hand->IsVisible();
|
||||
if (!bHandVisible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!USGTouchComponent::IsTouchable(OtherActor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LeftHandTouchState.ActorRingTouching = OtherActor;
|
||||
Pimpl->TriggerTouchStateUpdatedEvent(LeftHandTouchState);
|
||||
Pimpl->TriggerBeginTouch(LeftHandTouchState.Hand, OtherActor);
|
||||
}
|
||||
}
|
||||
|
||||
void ASGPawn::OnLeftRingFingertipTouchColliderOverlapEnds(
|
||||
@@ -977,12 +1110,19 @@ void ASGPawn::OnLeftRingFingertipTouchColliderOverlapEnds(
|
||||
(void) OtherComp;
|
||||
(void) OtherBodyIndex;
|
||||
|
||||
if (LeftHandTouchState.ActorRingTouching == OtherActor)
|
||||
if (!IsValid(LeftHandTouchState.Hand))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (LeftHandTouchState.ActorRingTouching != OtherActor)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LeftHandTouchState.ActorRingTouching = nullptr;
|
||||
Pimpl->TriggerTouchStateUpdatedEvent(LeftHandTouchState);
|
||||
Pimpl->TriggerEndTouch(LeftHandTouchState.Hand, OtherActor);
|
||||
}
|
||||
}
|
||||
|
||||
void ASGPawn::OnLeftPinkyFingertipTouchColliderOverlapBegins(
|
||||
@@ -999,12 +1139,25 @@ void ASGPawn::OnLeftPinkyFingertipTouchColliderOverlapBegins(
|
||||
(void) bFromSweep;
|
||||
(void) SweepResult;
|
||||
|
||||
if (USGTouchComponent::IsTouchable(OtherActor))
|
||||
if (!IsValid(LeftHandTouchState.Hand))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const bool bHandVisible = LeftHandTouchState.Hand->IsVisible();
|
||||
if (!bHandVisible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!USGTouchComponent::IsTouchable(OtherActor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LeftHandTouchState.ActorPinkyTouching = OtherActor;
|
||||
Pimpl->TriggerTouchStateUpdatedEvent(LeftHandTouchState);
|
||||
Pimpl->TriggerBeginTouch(LeftHandTouchState.Hand, OtherActor);
|
||||
}
|
||||
}
|
||||
|
||||
void ASGPawn::OnLeftPinkyFingertipTouchColliderOverlapEnds(
|
||||
@@ -1017,12 +1170,19 @@ void ASGPawn::OnLeftPinkyFingertipTouchColliderOverlapEnds(
|
||||
(void) OtherComp;
|
||||
(void) OtherBodyIndex;
|
||||
|
||||
if (LeftHandTouchState.ActorPinkyTouching == OtherActor)
|
||||
if (!IsValid(LeftHandTouchState.Hand))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (LeftHandTouchState.ActorPinkyTouching != OtherActor)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LeftHandTouchState.ActorPinkyTouching = nullptr;
|
||||
Pimpl->TriggerTouchStateUpdatedEvent(LeftHandTouchState);
|
||||
Pimpl->TriggerEndTouch(LeftHandTouchState.Hand, OtherActor);
|
||||
}
|
||||
}
|
||||
|
||||
void ASGPawn::OnRightThumbFingertipGrabColliderOverlapBegins(
|
||||
@@ -1039,11 +1199,24 @@ void ASGPawn::OnRightThumbFingertipGrabColliderOverlapBegins(
|
||||
(void) bFromSweep;
|
||||
(void) SweepResult;
|
||||
|
||||
if (USGGrabComponent::IsGrabbable(OtherActor))
|
||||
if (!IsValid(RightHandGrabState.Hand))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const bool bHandVisible = RightHandGrabState.Hand->IsVisible();
|
||||
if (!bHandVisible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!USGGrabComponent::IsGrabbable(OtherActor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RightHandGrabState.ActorThumbCanGrab = OtherActor;
|
||||
Pimpl->TriggerGrabStateUpdatedEvent(RightHandGrabState);
|
||||
}
|
||||
}
|
||||
|
||||
void ASGPawn::OnRightThumbFingertipGrabColliderOverlapEnds(
|
||||
@@ -1056,11 +1229,18 @@ void ASGPawn::OnRightThumbFingertipGrabColliderOverlapEnds(
|
||||
(void) OtherComp;
|
||||
(void) OtherBodyIndex;
|
||||
|
||||
if (RightHandGrabState.ActorThumbCanGrab == OtherActor)
|
||||
if (!IsValid(RightHandGrabState.Hand))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (RightHandGrabState.ActorThumbCanGrab != OtherActor)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RightHandGrabState.ActorThumbCanGrab = nullptr;
|
||||
Pimpl->TriggerGrabStateUpdatedEvent(RightHandGrabState);
|
||||
}
|
||||
}
|
||||
|
||||
void ASGPawn::OnRightIndexFingertipGrabColliderOverlapBegins(
|
||||
@@ -1077,11 +1257,24 @@ void ASGPawn::OnRightIndexFingertipGrabColliderOverlapBegins(
|
||||
(void) bFromSweep;
|
||||
(void) SweepResult;
|
||||
|
||||
if (USGGrabComponent::IsGrabbable(OtherActor))
|
||||
if (!IsValid(RightHandGrabState.Hand))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const bool bHandVisible = RightHandGrabState.Hand->IsVisible();
|
||||
if (!bHandVisible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!USGGrabComponent::IsGrabbable(OtherActor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RightHandGrabState.ActorIndexCanGrab = OtherActor;
|
||||
Pimpl->TriggerGrabStateUpdatedEvent(RightHandGrabState);
|
||||
}
|
||||
}
|
||||
|
||||
void ASGPawn::OnRightIndexFingertipGrabColliderOverlapEnds(
|
||||
@@ -1094,11 +1287,18 @@ void ASGPawn::OnRightIndexFingertipGrabColliderOverlapEnds(
|
||||
(void) OtherComp;
|
||||
(void) OtherBodyIndex;
|
||||
|
||||
if (RightHandGrabState.ActorThumbCanGrab == OtherActor)
|
||||
if (!IsValid(RightHandGrabState.Hand))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (RightHandGrabState.ActorThumbCanGrab != OtherActor)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RightHandGrabState.ActorIndexCanGrab = nullptr;
|
||||
Pimpl->TriggerGrabStateUpdatedEvent(RightHandGrabState);
|
||||
}
|
||||
}
|
||||
|
||||
void ASGPawn::OnRightMiddleFingertipGrabColliderOverlapBegins(
|
||||
@@ -1115,11 +1315,24 @@ void ASGPawn::OnRightMiddleFingertipGrabColliderOverlapBegins(
|
||||
(void) bFromSweep;
|
||||
(void) SweepResult;
|
||||
|
||||
if (USGGrabComponent::IsGrabbable(OtherActor))
|
||||
if (!IsValid(RightHandGrabState.Hand))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const bool bHandVisible = RightHandGrabState.Hand->IsVisible();
|
||||
if (!bHandVisible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!USGGrabComponent::IsGrabbable(OtherActor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RightHandGrabState.ActorMiddleCanGrab = OtherActor;
|
||||
Pimpl->TriggerGrabStateUpdatedEvent(RightHandGrabState);
|
||||
}
|
||||
}
|
||||
|
||||
void ASGPawn::OnRightMiddleFingertipGrabColliderOverlapEnds(
|
||||
@@ -1132,11 +1345,18 @@ void ASGPawn::OnRightMiddleFingertipGrabColliderOverlapEnds(
|
||||
(void) OtherComp;
|
||||
(void) OtherBodyIndex;
|
||||
|
||||
if (RightHandGrabState.ActorMiddleCanGrab == OtherActor)
|
||||
if (!IsValid(RightHandGrabState.Hand))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (RightHandGrabState.ActorMiddleCanGrab != OtherActor)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RightHandGrabState.ActorMiddleCanGrab = nullptr;
|
||||
Pimpl->TriggerGrabStateUpdatedEvent(RightHandGrabState);
|
||||
}
|
||||
}
|
||||
|
||||
void ASGPawn::OnRightThumbFingertipTouchColliderOverlapBegins(
|
||||
@@ -1153,12 +1373,25 @@ void ASGPawn::OnRightThumbFingertipTouchColliderOverlapBegins(
|
||||
(void) bFromSweep;
|
||||
(void) SweepResult;
|
||||
|
||||
if (USGTouchComponent::IsTouchable(OtherActor))
|
||||
if (!IsValid(RightHandTouchState.Hand))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const bool bHandVisible = RightHandTouchState.Hand->IsVisible();
|
||||
if (!bHandVisible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!USGTouchComponent::IsTouchable(OtherActor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RightHandTouchState.ActorThumbTouching = OtherActor;
|
||||
Pimpl->TriggerTouchStateUpdatedEvent(RightHandTouchState);
|
||||
Pimpl->TriggerBeginTouch(RightHandTouchState.Hand, OtherActor);
|
||||
}
|
||||
}
|
||||
|
||||
void ASGPawn::OnRightThumbFingertipTouchColliderOverlapEnds(
|
||||
@@ -1171,12 +1404,19 @@ void ASGPawn::OnRightThumbFingertipTouchColliderOverlapEnds(
|
||||
(void) OtherComp;
|
||||
(void) OtherBodyIndex;
|
||||
|
||||
if (RightHandTouchState.ActorThumbTouching == OtherActor)
|
||||
if (!IsValid(RightHandTouchState.Hand))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (RightHandTouchState.ActorThumbTouching != OtherActor)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RightHandTouchState.ActorThumbTouching = nullptr;
|
||||
Pimpl->TriggerTouchStateUpdatedEvent(RightHandTouchState);
|
||||
Pimpl->TriggerEndTouch(RightHandTouchState.Hand, OtherActor);
|
||||
}
|
||||
}
|
||||
|
||||
void ASGPawn::OnRightIndexFingertipTouchColliderOverlapBegins(
|
||||
@@ -1193,12 +1433,25 @@ void ASGPawn::OnRightIndexFingertipTouchColliderOverlapBegins(
|
||||
(void) bFromSweep;
|
||||
(void) SweepResult;
|
||||
|
||||
if (USGTouchComponent::IsTouchable(OtherActor))
|
||||
if (!IsValid(RightHandTouchState.Hand))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const bool bHandVisible = RightHandTouchState.Hand->IsVisible();
|
||||
if (!bHandVisible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!USGTouchComponent::IsTouchable(OtherActor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RightHandTouchState.ActorIndexTouching = OtherActor;
|
||||
Pimpl->TriggerTouchStateUpdatedEvent(RightHandTouchState);
|
||||
Pimpl->TriggerBeginTouch(RightHandTouchState.Hand, OtherActor);
|
||||
}
|
||||
}
|
||||
|
||||
void ASGPawn::OnRightIndexFingertipTouchColliderOverlapEnds(
|
||||
@@ -1211,12 +1464,19 @@ void ASGPawn::OnRightIndexFingertipTouchColliderOverlapEnds(
|
||||
(void) OtherComp;
|
||||
(void) OtherBodyIndex;
|
||||
|
||||
if (RightHandTouchState.ActorIndexTouching == OtherActor)
|
||||
if (!IsValid(RightHandTouchState.Hand))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (RightHandTouchState.ActorIndexTouching != OtherActor)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RightHandTouchState.ActorIndexTouching = nullptr;
|
||||
Pimpl->TriggerTouchStateUpdatedEvent(RightHandTouchState);
|
||||
Pimpl->TriggerEndTouch(RightHandTouchState.Hand, OtherActor);
|
||||
}
|
||||
}
|
||||
|
||||
void ASGPawn::OnRightMiddleFingertipTouchColliderOverlapBegins(
|
||||
@@ -1233,12 +1493,25 @@ void ASGPawn::OnRightMiddleFingertipTouchColliderOverlapBegins(
|
||||
(void) bFromSweep;
|
||||
(void) SweepResult;
|
||||
|
||||
if (USGTouchComponent::IsTouchable(OtherActor))
|
||||
if (!IsValid(RightHandTouchState.Hand))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const bool bHandVisible = RightHandTouchState.Hand->IsVisible();
|
||||
if (!bHandVisible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!USGTouchComponent::IsTouchable(OtherActor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RightHandTouchState.ActorMiddleTouching = OtherActor;
|
||||
Pimpl->TriggerTouchStateUpdatedEvent(RightHandTouchState);
|
||||
Pimpl->TriggerBeginTouch(RightHandTouchState.Hand, OtherActor);
|
||||
}
|
||||
}
|
||||
|
||||
void ASGPawn::OnRightMiddleFingertipTouchColliderOverlapEnds(
|
||||
@@ -1251,12 +1524,19 @@ void ASGPawn::OnRightMiddleFingertipTouchColliderOverlapEnds(
|
||||
(void) OtherComp;
|
||||
(void) OtherBodyIndex;
|
||||
|
||||
if (RightHandTouchState.ActorMiddleTouching == OtherActor)
|
||||
if (!IsValid(RightHandTouchState.Hand))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (RightHandTouchState.ActorMiddleTouching != OtherActor)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RightHandTouchState.ActorMiddleTouching = nullptr;
|
||||
Pimpl->TriggerTouchStateUpdatedEvent(RightHandTouchState);
|
||||
Pimpl->TriggerEndTouch(RightHandTouchState.Hand, OtherActor);
|
||||
}
|
||||
}
|
||||
|
||||
void ASGPawn::OnRightRingFingertipTouchColliderOverlapBegins(
|
||||
@@ -1273,12 +1553,25 @@ void ASGPawn::OnRightRingFingertipTouchColliderOverlapBegins(
|
||||
(void) bFromSweep;
|
||||
(void) SweepResult;
|
||||
|
||||
if (USGTouchComponent::IsTouchable(OtherActor))
|
||||
if (!IsValid(RightHandTouchState.Hand))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const bool bHandVisible = RightHandTouchState.Hand->IsVisible();
|
||||
if (!bHandVisible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!USGTouchComponent::IsTouchable(OtherActor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RightHandTouchState.ActorRingTouching = OtherActor;
|
||||
Pimpl->TriggerTouchStateUpdatedEvent(RightHandTouchState);
|
||||
Pimpl->TriggerBeginTouch(RightHandTouchState.Hand, OtherActor);
|
||||
}
|
||||
}
|
||||
|
||||
void ASGPawn::OnRightRingFingertipTouchColliderOverlapEnds(
|
||||
@@ -1291,12 +1584,19 @@ void ASGPawn::OnRightRingFingertipTouchColliderOverlapEnds(
|
||||
(void) OtherComp;
|
||||
(void) OtherBodyIndex;
|
||||
|
||||
if (RightHandTouchState.ActorRingTouching == OtherActor)
|
||||
if (!IsValid(RightHandTouchState.Hand))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (RightHandTouchState.ActorRingTouching != OtherActor)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RightHandTouchState.ActorRingTouching = nullptr;
|
||||
Pimpl->TriggerTouchStateUpdatedEvent(RightHandTouchState);
|
||||
Pimpl->TriggerEndTouch(RightHandTouchState.Hand, OtherActor);
|
||||
}
|
||||
}
|
||||
|
||||
void ASGPawn::OnRightPinkyFingertipTouchColliderOverlapBegins(
|
||||
@@ -1313,12 +1613,25 @@ void ASGPawn::OnRightPinkyFingertipTouchColliderOverlapBegins(
|
||||
(void) bFromSweep;
|
||||
(void) SweepResult;
|
||||
|
||||
if (USGTouchComponent::IsTouchable(OtherActor))
|
||||
if (!IsValid(RightHandTouchState.Hand))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const bool bHandVisible = RightHandTouchState.Hand->IsVisible();
|
||||
if (!bHandVisible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!USGTouchComponent::IsTouchable(OtherActor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RightHandTouchState.ActorPinkyTouching = OtherActor;
|
||||
Pimpl->TriggerTouchStateUpdatedEvent(RightHandTouchState);
|
||||
Pimpl->TriggerBeginTouch(RightHandTouchState.Hand, OtherActor);
|
||||
}
|
||||
}
|
||||
|
||||
void ASGPawn::OnRightPinkyFingertipTouchColliderOverlapEnds(
|
||||
@@ -1331,34 +1644,51 @@ void ASGPawn::OnRightPinkyFingertipTouchColliderOverlapEnds(
|
||||
(void) OtherComp;
|
||||
(void) OtherBodyIndex;
|
||||
|
||||
if (RightHandTouchState.ActorPinkyTouching == OtherActor)
|
||||
if (!IsValid(RightHandTouchState.Hand))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (RightHandTouchState.ActorPinkyTouching != OtherActor)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
RightHandTouchState.ActorPinkyTouching = nullptr;
|
||||
Pimpl->TriggerTouchStateUpdatedEvent(RightHandTouchState);
|
||||
Pimpl->TriggerEndTouch(RightHandTouchState.Hand, OtherActor);
|
||||
}
|
||||
}
|
||||
|
||||
bool ASGPawn::IsLeftHandGrabbing(AActor*& OutActor) const
|
||||
{
|
||||
if (IsValid(LeftHandGrabState.GrabbedActor))
|
||||
if (!IsValid(LeftHandGrabState.Hand))
|
||||
{
|
||||
OutActor = LeftHandGrabState.GrabbedActor;
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!IsValid(LeftHandGrabState.GrabbedActor))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutActor = LeftHandGrabState.GrabbedActor;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASGPawn::IsRightHandGrabbing(AActor*& OutActor) const
|
||||
{
|
||||
if (IsValid(RightHandGrabState.GrabbedActor))
|
||||
if (!IsValid(RightHandGrabState.Hand))
|
||||
{
|
||||
OutActor = RightHandGrabState.GrabbedActor;
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!IsValid(RightHandGrabState.GrabbedActor))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
OutActor = RightHandGrabState.GrabbedActor;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ASGPawn::IsGrabbing(const USGVirtualHandComponent* Hand, AActor*& OutActor) const
|
||||
@@ -1368,13 +1698,24 @@ bool ASGPawn::IsGrabbing(const USGVirtualHandComponent* Hand, AActor*& OutActor)
|
||||
|
||||
void ASGPawn::Grab(USGVirtualHandComponent* Hand, AActor* Actor)
|
||||
{
|
||||
if (!ensureAlwaysMsgf(IsValid(Hand), TEXT("%s"), TEXT("ERROR: invalid hand!")))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const bool bHandVisible = Hand->IsVisible();
|
||||
if (!bHandVisible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ensureAlwaysMsgf(IsValid(Actor), TEXT("%s"), TEXT("ERROR: invalid actor!")))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const USGGrabComponent* GrabComponent{USGGrabComponent::GetGrabComponent(Actor)};
|
||||
if (!GrabComponent)
|
||||
if (!IsValid(GrabComponent))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -266,6 +266,16 @@ void ASGPlayerController::BeginPlay()
|
||||
return;
|
||||
}
|
||||
|
||||
const bool bHandVisible = GrabState.Hand->IsVisible();
|
||||
if (!bHandVisible)
|
||||
{
|
||||
if (SGPawn->IsGrabbing(GrabState.Hand))
|
||||
{
|
||||
SGPawn->Release(GrabState.Hand);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (SGPawn->IsGrabbing(GrabState.Hand))
|
||||
{
|
||||
if (!IsValid(GrabState.ActorThumbCanGrab) ||
|
||||
@@ -287,6 +297,28 @@ void ASGPlayerController::BeginPlay()
|
||||
SGPawn->OnTouchStateUpdated().AddWeakLambda(
|
||||
this, [= SG_CAPTURE_THIS](const FSGTouchState& TouchState) -> void
|
||||
{
|
||||
if (!IsValid(SGPawn))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IsValid(TouchState.Hand))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const bool bHandVisible = TouchState.Hand->IsVisible();
|
||||
if (!bHandVisible)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const bool bGloveConnected = TouchState.Hand->IsGloveConnected();
|
||||
if (!bGloveConnected)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Pimpl->UpdateHapticsFeedback(TouchState);
|
||||
});
|
||||
}
|
||||
@@ -313,6 +345,12 @@ void ASGPlayerController::FImpl::UpdateHapticsFeedback(const FSGTouchState& Touc
|
||||
return;
|
||||
}
|
||||
|
||||
const bool bGloveConnected = Glove->IsConnected()
|
||||
if (!bGloveConnected)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Queue the Force-Feedback command...
|
||||
TArray<float> ForceFeedbackLevels{
|
||||
GetForceFeedbackLevels(
|
||||
@@ -342,11 +380,19 @@ void ASGPlayerController::FImpl::UpdateHapticsFeedback(const FSGTouchState& Touc
|
||||
FTimerDelegate TouchVibrotactileStopHandler;
|
||||
TouchVibrotactileStopHandler.BindLambda([= SG_CAPTURE_THIS]()-> void
|
||||
{
|
||||
if (IsValid(Glove))
|
||||
if (!IsValid(Glove))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const bool bGloveConnected = Glove->IsConnected();
|
||||
if (!bGloveConnected)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Glove->QueueVibroLevels(VibrotactileOffCommand);
|
||||
Glove->SendHaptics();
|
||||
}
|
||||
});
|
||||
|
||||
Owner->GetWorldTimerManager().SetTimer(
|
||||
|
||||
Reference in New Issue
Block a user