fix grab/release bug for the right hand
This commit is contained in:
@@ -435,7 +435,7 @@ ASGPawn::ASGPawn(const FObjectInitializer& ObjectInitializer)
|
||||
LeftHandGrabState = FSGGrabState(HandLeft, nullptr, nullptr, nullptr, nullptr);
|
||||
LeftHandTouchState = FSGTouchState(HandLeft, nullptr, nullptr, nullptr, nullptr, nullptr);
|
||||
|
||||
RightHandGrabState = FSGGrabState(HandLeft, nullptr, nullptr, nullptr, nullptr);
|
||||
RightHandGrabState = FSGGrabState(HandRight, nullptr, nullptr, nullptr, nullptr);
|
||||
RightHandTouchState = FSGTouchState(HandRight, nullptr, nullptr, nullptr, nullptr, nullptr);
|
||||
}
|
||||
|
||||
@@ -1145,15 +1145,36 @@ void ASGPawn::Grab(USGVirtualHandComponent* Hand, AActor* Actor)
|
||||
const bool bAttached = Actor->AttachToComponent(Hand, MoveTemp(AttachmentRules), SocketName);
|
||||
if (bAttached)
|
||||
{
|
||||
LeftHandGrabState.GrabbedActor = Actor;
|
||||
if (Hand->IsRight())
|
||||
{
|
||||
RightHandGrabState.GrabbedActor = Actor;
|
||||
}
|
||||
else
|
||||
{
|
||||
LeftHandGrabState.GrabbedActor = Actor;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SGLOG_ERROR("Failed to grab the actor with the left hand!", Actor, SocketName);
|
||||
if (Hand->IsRight())
|
||||
{
|
||||
SGLOG_ERROR("Failed to grab the actor with the right hand!", Actor, SocketName);
|
||||
}
|
||||
else
|
||||
{
|
||||
SGLOG_ERROR("Failed to grab the actor with the left hand!", Actor, SocketName);
|
||||
}
|
||||
}
|
||||
#else
|
||||
Actor->AttachToComponent(Hand, MoveTemp(AttachmentRules), SocketName);
|
||||
LeftHandGrabState.GrabbedActor = Actor;
|
||||
if (Hand->IsRight())
|
||||
{
|
||||
RightHandGrabState.GrabbedActor = Actor;
|
||||
}
|
||||
else
|
||||
{
|
||||
LeftHandGrabState.GrabbedActor = Actor;
|
||||
}
|
||||
#endif /* ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 2 */
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user