update VRExpansionPlugin plugin with changes from upstream
This commit is contained in:
+2
-2
@@ -107,7 +107,7 @@ TWeakObjectPtr<UAnimSequence> FHandSocketComponentDetails::SaveAnimationAsset(co
|
||||
|
||||
if (!BaseAnimation)
|
||||
{
|
||||
LocalPoses = HandSocketComponent->VisualizationMesh->GetSkeleton()->GetRefLocalPoses();
|
||||
LocalPoses = HandSocketComponent->VisualizationMesh->GetRefSkeleton().GetRefBonePose();
|
||||
}
|
||||
|
||||
// If not, create new one now.
|
||||
@@ -251,7 +251,7 @@ TWeakObjectPtr<UAnimSequence> FHandSocketComponentDetails::SaveAnimationAsset(co
|
||||
int32 BoneIndex = BoneTreeIndex;//AnimSkeleton->GetMeshBoneIndexFromSkeletonBoneIndex(SkeletalMesh, BoneTreeIndex);
|
||||
//int32 ParentIndex = SkeletalMesh->RefSkeleton.GetParentIndex(BoneIndex);
|
||||
FTransform LocalTransform = LocalPoses[BoneIndex];
|
||||
|
||||
//FTransform LocalTransform = RefSkeleton.GetRefBonePose()[BoneIndex];
|
||||
|
||||
FName BoneName = AnimSkeleton->GetReferenceSkeleton().GetBoneName(BoneIndex);
|
||||
|
||||
|
||||
+26
-12
@@ -4310,7 +4310,7 @@ bool UGripMotionControllerComponent::TeleportMoveGrippedActor(AActor * GrippedAc
|
||||
|
||||
FBPActorGripInformation * GripInfo = LocallyGrippedObjects.FindByKey(GrippedActorToMove);
|
||||
if (!GripInfo)
|
||||
GrippedObjects.FindByKey(GrippedActorToMove);
|
||||
GripInfo = GrippedObjects.FindByKey(GrippedActorToMove);
|
||||
|
||||
if (GripInfo)
|
||||
{
|
||||
@@ -4327,7 +4327,7 @@ bool UGripMotionControllerComponent::TeleportMoveGrippedComponent(UPrimitiveComp
|
||||
|
||||
FBPActorGripInformation * GripInfo = LocallyGrippedObjects.FindByKey(ComponentToMove);
|
||||
if (!GripInfo)
|
||||
GrippedObjects.FindByKey(ComponentToMove);
|
||||
GripInfo = GrippedObjects.FindByKey(ComponentToMove);
|
||||
|
||||
if (GripInfo)
|
||||
{
|
||||
@@ -6017,7 +6017,7 @@ void UGripMotionControllerComponent::CleanUpBadPhysicsHandles()
|
||||
{
|
||||
FBPActorGripInformation * GripInfo = LocallyGrippedObjects.FindByKey(PhysicsGrips[g].GripID);
|
||||
if(!GripInfo)
|
||||
GrippedObjects.FindByKey(PhysicsGrips[g].GripID);
|
||||
GripInfo = GrippedObjects.FindByKey(PhysicsGrips[g].GripID);
|
||||
|
||||
if (!GripInfo)
|
||||
{
|
||||
@@ -7214,18 +7214,25 @@ void UGripMotionControllerComponent::ApplyTrackingParameters(FVector& OriginalPo
|
||||
if (GEngine->XRSystem->GetCurrentPose(IXRTrackingSystem::HMDDeviceId, curRot, curLoc))
|
||||
{
|
||||
|
||||
if (IsValid(AttachChar) && AttachChar->VRReplicatedCamera)
|
||||
/*if (IsValid(AttachChar) && AttachChar->VRReplicatedCamera)
|
||||
{
|
||||
AttachChar->VRReplicatedCamera->ApplyTrackingParameters(curLoc, true);
|
||||
}
|
||||
}*/
|
||||
|
||||
//curLoc.Z = 0;
|
||||
LastLocationForLateUpdate = curLoc;
|
||||
|
||||
if (IsValid(AttachChar) && !AttachChar->bRetainRoomscale)
|
||||
{
|
||||
FRotator StoredCameraRotOffset = UVRExpansionFunctionLibrary::GetHMDPureYaw_I(curRot.Rotator());
|
||||
LastLocationForLateUpdate += StoredCameraRotOffset.RotateVector(FVector(AttachChar->VRRootReference->VRCapsuleOffset.X, AttachChar->VRRootReference->VRCapsuleOffset.Y, 0.0f));
|
||||
if (AttachChar->VRMovementReference && AttachChar->VRMovementReference->GetReplicatedMovementMode() == EVRConjoinedMovementModes::C_VRMOVE_Seated)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
FRotator StoredCameraRotOffset = UVRExpansionFunctionLibrary::GetHMDPureYaw_I(curRot.Rotator());
|
||||
LastLocationForLateUpdate += StoredCameraRotOffset.RotateVector(FVector(AttachChar->VRRootReference->VRCapsuleOffset.X, AttachChar->VRRootReference->VRCapsuleOffset.Y, 0.0f));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7234,12 +7241,19 @@ void UGripMotionControllerComponent::ApplyTrackingParameters(FVector& OriginalPo
|
||||
if (IsValid(AttachChar) && AttachChar->VRReplicatedCamera)
|
||||
{
|
||||
// Sample camera location instead
|
||||
LastLocationForLateUpdate = AttachChar->VRReplicatedCamera->GetRelativeLocation();
|
||||
LastLocationForLateUpdate = AttachChar->VRReplicatedCamera->ReplicatedCameraTransform.Position; //GetRelativeLocation();
|
||||
|
||||
if (!AttachChar->bRetainRoomscale && IsLocallyControlled())
|
||||
{
|
||||
FRotator StoredCameraRotOffset = UVRExpansionFunctionLibrary::GetHMDPureYaw_I(AttachChar->VRReplicatedCamera->GetRelativeRotation());
|
||||
LastLocationForLateUpdate += StoredCameraRotOffset.RotateVector(FVector(AttachChar->VRRootReference->VRCapsuleOffset.X, AttachChar->VRRootReference->VRCapsuleOffset.Y, 0.0f));
|
||||
if (AttachChar->VRMovementReference && AttachChar->VRMovementReference->GetReplicatedMovementMode() == EVRConjoinedMovementModes::C_VRMOVE_Seated)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
FRotator StoredCameraRotOffset = UVRExpansionFunctionLibrary::GetHMDPureYaw_I(AttachChar->VRReplicatedCamera->GetRelativeRotation());
|
||||
LastLocationForLateUpdate += StoredCameraRotOffset.RotateVector(FVector(AttachChar->VRRootReference->VRCapsuleOffset.X, AttachChar->VRRootReference->VRCapsuleOffset.Y, 0.0f));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8334,12 +8348,12 @@ void UGripMotionControllerComponent::GetHandType(EControllerHand& Hand)
|
||||
{
|
||||
// Check if the palm motion source extension is being used
|
||||
// I assume eventually epic will handle this case
|
||||
if (MotionSource.Compare(FName(TEXT("RightPalm"))) == 0)
|
||||
if (MotionSource.Compare(FName(TEXT("RightPalm"))) == 0 || MotionSource.Compare(FName(TEXT("RightWrist"))) == 0)
|
||||
{
|
||||
Hand = EControllerHand::Right;
|
||||
}
|
||||
// Could skip this and default to left now but would rather check
|
||||
else if (MotionSource.Compare(FName(TEXT("LeftPalm"))) == 0)
|
||||
else if (MotionSource.Compare(FName(TEXT("LeftPalm"))) == 0 || MotionSource.Compare(FName(TEXT("LeftWrist"))) == 0)
|
||||
{
|
||||
Hand = EControllerHand::Left;
|
||||
}
|
||||
|
||||
+2
-2
@@ -805,11 +805,11 @@ void AGrippableStaticMeshActor::OnRep_ReplicatedMovement()
|
||||
return;
|
||||
}
|
||||
|
||||
if (VRGripInterfaceSettings.HoldingControllers.Num() > 0)
|
||||
/*if (VRGripInterfaceSettings.HoldingControllers.Num() > 0)
|
||||
{
|
||||
ShouldWeSkipAttachmentReplication();
|
||||
int gg = 0;
|
||||
}
|
||||
}*/
|
||||
|
||||
Super::OnRep_ReplicatedMovement();
|
||||
}
|
||||
|
||||
+7
-4
@@ -397,7 +397,8 @@ bool UHandSocketComponent::GetBlendedPoseSnapShot(FPoseSnapshot& PoseSnapShot, U
|
||||
PoseSnapShot.LocalTransforms.Empty();
|
||||
TargetMesh->GetBoneNames(PoseSnapShot.BoneNames);
|
||||
|
||||
PoseSnapShot.LocalTransforms = TargetMesh->GetSkinnedAsset()->GetSkeleton()->GetRefLocalPoses();
|
||||
//PoseSnapShot.LocalTransforms = TargetMesh->GetSkinnedAsset()->GetSkeleton()->GetRefLocalPoses();
|
||||
PoseSnapShot.LocalTransforms = TargetMesh->GetSkinnedAsset()->GetRefSkeleton().GetRefBonePose();
|
||||
|
||||
FQuat DeltaQuat = FQuat::Identity;
|
||||
FName TargetBoneName = NAME_None;
|
||||
@@ -692,7 +693,7 @@ void UHandSocketComponent::OnRegister()
|
||||
{
|
||||
if (HandPreviewMaterial)
|
||||
{
|
||||
HandVisualizerComponent->SetMaterial(0, (UMaterialInterface*)HandPreviewMaterial);
|
||||
HandVisualizerComponent->SetMaterial(0, HandPreviewMaterial);
|
||||
}
|
||||
HandVisualizerComponent->SetSkinnedAssetAndUpdate(VisualizationMesh);
|
||||
}
|
||||
@@ -782,9 +783,11 @@ void UHandSocketComponent::PoseVisualizationToAnimation(bool bForceRefresh)
|
||||
if (!HandTargetAnimation)
|
||||
{
|
||||
// Store local poses for posing
|
||||
LocalPoses = HandVisualizerComponent->GetSkinnedAsset()->GetSkeleton()->GetRefLocalPoses();
|
||||
LocalPoses = HandVisualizerComponent->GetSkinnedAsset()->GetRefSkeleton().GetRefBonePose();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Check out of the skin cache, the poses don't update otherwise when enabled
|
||||
int32 NumLODs = HandVisualizerComponent->GetNumLODs();
|
||||
HandVisualizerComponent->SkinCacheUsage.Empty(NumLODs);
|
||||
@@ -841,6 +844,7 @@ void UHandSocketComponent::PoseVisualizationToAnimation(bool bForceRefresh)
|
||||
else
|
||||
{
|
||||
BoneTrans = LocalPoses[i];
|
||||
//BoneTrans = HandVisualizerComponent->GetSkinnedAsset()->GetRefSkeleton().GetRefBonePose()[i];
|
||||
}
|
||||
|
||||
BoneTrans = BoneTrans * ParentTrans;// *HandVisualizerComponent->GetComponentTransform();
|
||||
@@ -851,7 +855,6 @@ void UHandSocketComponent::PoseVisualizationToAnimation(bool bForceRefresh)
|
||||
BoneTrans.ConcatenateRotation(DeltaQuat);
|
||||
BoneTrans.NormalizeRotation();
|
||||
HandVisualizerComponent->SetBoneTransformByName(BonesNames[i], BoneTrans, EBoneSpaces::ComponentSpace);
|
||||
|
||||
}
|
||||
|
||||
if (HandVisualizerComponent && (!bTickedPose || bForceRefresh))
|
||||
|
||||
+19
-9
@@ -272,24 +272,34 @@ void UVRDialComponent::OnGripRelease_Implementation(UGripMotionControllerCompone
|
||||
float AngleOffsetCheck = FMath::Abs(FRotator::ClampAxis(CurRotBackEnd) - FRotator::ClampAxis(LastSnapAngle));
|
||||
float TargetSnap = FMath::RoundToFloat(FMath::GridSnap(CurRotBackEnd, SnapAngleIncrement));
|
||||
|
||||
if (FMath::Abs(FRotator::ClampAxis(CurRotBackEnd) - TargetSnap) <= FMath::Min(SnapAngleIncrement, SnapAngleThreshold))
|
||||
if (FMath::Abs(/*FRotator::ClampAxis(*/CurRotBackEnd/*)*/ - TargetSnap) <= FMath::Min(SnapAngleIncrement, SnapAngleThreshold))
|
||||
{
|
||||
if (AngleOffsetCheck >= SnapAngleThreshold)//FMath::Min(SnapAngleIncrement, SnapAngleThreshold))
|
||||
{
|
||||
this->SetRelativeRotation((FTransform(UVRInteractibleFunctionLibrary::SetAxisValueRot(DialRotationAxis, FMath::GridSnap(CurRotBackEnd, SnapAngleIncrement), FRotator::ZeroRotator)) * InitialRelativeTransform).Rotator());
|
||||
CurRotBackEnd = FMath::GridSnap(CurRotBackEnd, SnapAngleIncrement);
|
||||
|
||||
if (bUseRollover)
|
||||
{
|
||||
CurrentDialAngle = FMath::RoundToFloat(CurRotBackEnd);
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrentDialAngle = FRotator::ClampAxis(FMath::RoundToFloat(CurRotBackEnd));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Reset to the snap angle so that it requires full motion to break out of it
|
||||
CurRotBackEnd = CurrentDialAngle;
|
||||
}
|
||||
}
|
||||
|
||||
if (bUseRollover)
|
||||
{
|
||||
CurrentDialAngle = FMath::RoundToFloat(CurRotBackEnd);
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrentDialAngle = FRotator::ClampAxis(FMath::RoundToFloat(CurRotBackEnd));
|
||||
// Reset to the snap angle so that it requires full motion to break out of it
|
||||
CurRotBackEnd = CurrentDialAngle;
|
||||
}
|
||||
|
||||
|
||||
if (!FMath::IsNearlyEqual(LastSnapAngle, CurrentDialAngle))
|
||||
{
|
||||
ReceiveDialHitSnapAngle(CurrentDialAngle);
|
||||
@@ -582,7 +592,7 @@ void UVRDialComponent::AddDialAngle(float DialAngleDelta, bool bCallEvents, bool
|
||||
float AngleOffsetCheck = FMath::Abs(FRotator::ClampAxis(CurRotBackEnd) - FRotator::ClampAxis(LastSnapAngle));
|
||||
float TargetSnap = FMath::RoundToFloat(FMath::GridSnap(CurRotBackEnd, SnapAngleIncrement));
|
||||
|
||||
if (FMath::Abs(FRotator::ClampAxis(CurRotBackEnd) - TargetSnap) <= FMath::Min(SnapAngleIncrement, SnapAngleThreshold))
|
||||
if (FMath::Abs(/*FRotator::ClampAxis(*/CurRotBackEnd/*)*/ - TargetSnap) <= FMath::Min(SnapAngleIncrement, SnapAngleThreshold))
|
||||
{
|
||||
if (AngleOffsetCheck >= SnapAngleThreshold)//FMath::Min(SnapAngleIncrement, SnapAngleThreshold))
|
||||
{
|
||||
|
||||
+12
-20
@@ -161,17 +161,14 @@ void UCollisionIgnoreSubsystem::CheckActiveFilters()
|
||||
{
|
||||
bool bMadeChanges = false;
|
||||
|
||||
for (TPair<FCollisionPrimPair, FCollisionIgnorePairArray>& KeyPair : CollisionTrackedPairs)
|
||||
for (TMap<FCollisionPrimPair, FCollisionIgnorePairArray>::TIterator ItRemove = CollisionTrackedPairs.CreateIterator(); ItRemove; ++ItRemove)
|
||||
{
|
||||
// First check for invalid primitives
|
||||
if (!IsValid(KeyPair.Key.Prim1) || !IsValid(KeyPair.Key.Prim2))
|
||||
// First check for invalid primitives and an empty pair array
|
||||
if (!IsValid(ItRemove->Key.Prim1) || !IsValid(ItRemove->Key.Prim2) || ItRemove->Value.PairArray.Num() < 1)
|
||||
{
|
||||
// If we don't have a map element for this pair, then add it now
|
||||
if (!RemovedPairs.Contains(KeyPair.Key))
|
||||
{
|
||||
RemovedPairs.Add(KeyPair.Key, KeyPair.Value);
|
||||
bMadeChanges = true;
|
||||
}
|
||||
ItRemove->Value.PairArray.Empty();
|
||||
ItRemove.RemoveCurrent();
|
||||
bMadeChanges = true;
|
||||
|
||||
continue; // skip remaining checks as we have invalid primitives anyway
|
||||
}
|
||||
@@ -267,16 +264,6 @@ void UCollisionIgnoreSubsystem::CheckActiveFilters()
|
||||
});
|
||||
}
|
||||
#endif
|
||||
|
||||
// If there are no pairs left
|
||||
if (KeyPair.Value.PairArray.Num() < 1)
|
||||
{
|
||||
// Try and remove it, chaos should be cleaning up the ignore setups
|
||||
if (!RemovedPairs.Contains(KeyPair.Key))
|
||||
{
|
||||
RemovedPairs.Add(KeyPair.Key, KeyPair.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*#if WITH_CHAOS
|
||||
@@ -295,13 +282,18 @@ void UCollisionIgnoreSubsystem::CheckActiveFilters()
|
||||
}
|
||||
#endif*/
|
||||
|
||||
for (const TPair<FCollisionPrimPair, FCollisionIgnorePairArray>& KeyPair : RemovedPairs)
|
||||
/*for (const TPair<FCollisionPrimPair, FCollisionIgnorePairArray>& KeyPair : RemovedPairs)
|
||||
{
|
||||
if (CollisionTrackedPairs.Contains(KeyPair.Key))
|
||||
{
|
||||
CollisionTrackedPairs[KeyPair.Key].PairArray.Empty();
|
||||
CollisionTrackedPairs.Remove(KeyPair.Key);
|
||||
}
|
||||
}*/
|
||||
|
||||
if (bMadeChanges)
|
||||
{
|
||||
CollisionTrackedPairs.Compact();
|
||||
}
|
||||
|
||||
UpdateTimer(bMadeChanges);
|
||||
|
||||
+4
-4
@@ -210,7 +210,7 @@ void UReplicatedVRCameraComponent::UpdateTracking(float DeltaTime)
|
||||
FRotator StoredCameraRotOffset = FRotator::ZeroRotator;
|
||||
if (AttachChar->VRMovementReference && AttachChar->VRMovementReference->GetReplicatedMovementMode() == EVRConjoinedMovementModes::C_VRMOVE_Seated)
|
||||
{
|
||||
AttachChar->SeatInformation.InitialRelCameraTransform.Rotator();
|
||||
//StoredCameraRotOffset = AttachChar->SeatInformation.InitialRelCameraTransform.Rotator();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -250,7 +250,7 @@ void UReplicatedVRCameraComponent::RunNetworkedSmoothing(float DeltaTime)
|
||||
FRotator StoredCameraRotOffset = FRotator::ZeroRotator;
|
||||
if (AttachChar->VRMovementReference && AttachChar->VRMovementReference->GetReplicatedMovementMode() == EVRConjoinedMovementModes::C_VRMOVE_Seated)
|
||||
{
|
||||
AttachChar->SeatInformation.InitialRelCameraTransform.Rotator();
|
||||
//StoredCameraRotOffset = AttachChar->SeatInformation.InitialRelCameraTransform.Rotator();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -485,7 +485,7 @@ void UReplicatedVRCameraComponent::HandleXRCamera()
|
||||
FRotator StoredCameraRotOffset = FRotator::ZeroRotator;
|
||||
if (AttachChar->VRMovementReference->GetReplicatedMovementMode() == EVRConjoinedMovementModes::C_VRMOVE_Seated)
|
||||
{
|
||||
AttachChar->SeatInformation.InitialRelCameraTransform.Rotator();
|
||||
//StoredCameraRotOffset = AttachChar->SeatInformation.InitialRelCameraTransform.Rotator();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -536,7 +536,7 @@ void UReplicatedVRCameraComponent::OnRep_ReplicatedCameraTransform()
|
||||
FRotator StoredCameraRotOffset = FRotator::ZeroRotator;
|
||||
if (AttachChar->VRMovementReference && AttachChar->VRMovementReference->GetReplicatedMovementMode() == EVRConjoinedMovementModes::C_VRMOVE_Seated)
|
||||
{
|
||||
AttachChar->SeatInformation.InitialRelCameraTransform.Rotator();
|
||||
//StoredCameraRotOffset = AttachChar->SeatInformation.InitialRelCameraTransform.Rotator();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -283,6 +283,21 @@ UPrimitiveComponent* FBPActorGripInformation::GetGrippedComponent() const
|
||||
return Cast<UPrimitiveComponent>(GrippedObject);
|
||||
}
|
||||
|
||||
|
||||
UPrimitiveComponent* FBPActorGripInformation::GetGripPrimitiveComponent() const
|
||||
{
|
||||
UPrimitiveComponent* RootComp = nullptr;
|
||||
|
||||
if (GripTargetType == EGripTargetType::ActorGrip)
|
||||
{
|
||||
RootComp = Cast<UPrimitiveComponent>(GetGrippedActor()->GetRootComponent());
|
||||
}
|
||||
else
|
||||
RootComp = GetGrippedComponent();
|
||||
|
||||
return RootComp;
|
||||
}
|
||||
|
||||
bool FBPActorGripInformation::operator==(const UPrimitiveComponent* Other) const
|
||||
{
|
||||
if (Other && GrippedObject && GrippedObject == (const UObject*)Other)
|
||||
|
||||
+5
-1
@@ -340,7 +340,11 @@ void UVRCharacterMovementComponent::UnCrouch(bool bClientSimulation)
|
||||
if (!bEncroached)
|
||||
{
|
||||
// Commit the change in location.
|
||||
//UpdatedComponent->MoveComponent(StandingLocation - PawnLocation, UpdatedComponent->GetComponentQuat(), false, nullptr, EMoveComponentFlags::MOVECOMP_NoFlags, ETeleportType::TeleportPhysics);
|
||||
if (!BaseVRCharacterOwner || !BaseVRCharacterOwner->bRetainRoomscale)
|
||||
{
|
||||
// we actually move this when not using retained roomscale
|
||||
//UpdatedComponent->MoveComponent(StandingLocation - PawnLocation, UpdatedComponent->GetComponentQuat(), false, nullptr, EMoveComponentFlags::MOVECOMP_NoFlags, ETeleportType::TeleportPhysics);
|
||||
}
|
||||
bForceNextFloorCheck = true;
|
||||
}
|
||||
}
|
||||
|
||||
+5
@@ -586,6 +586,11 @@ bool UVRExpansionFunctionLibrary::IsActiveGrip(const FBPActorGripInformation& Gr
|
||||
return Grip.IsActive();
|
||||
}
|
||||
|
||||
UPrimitiveComponent* UVRExpansionFunctionLibrary::GetGripPrimitiveTarget(const FBPActorGripInformation& Grip)
|
||||
{
|
||||
return Grip.GetGripPrimitiveComponent();
|
||||
}
|
||||
|
||||
FTransform_NetQuantize UVRExpansionFunctionLibrary::MakeTransform_NetQuantize(FVector Translation, FRotator Rotation, FVector Scale)
|
||||
{
|
||||
return FTransform_NetQuantize(Rotation, Translation, Scale);
|
||||
|
||||
@@ -468,7 +468,7 @@ void UVRRootComponent::UpdateCharacterCapsuleOffset()
|
||||
{
|
||||
if (owningVRChar && !owningVRChar->bRetainRoomscale && owningVRChar->NetSmoother)
|
||||
{
|
||||
if (!FMath::IsNearlyEqual(LastCapsuleHalfHeight, CapsuleHalfHeight))
|
||||
if (bCenterCapsuleOnHMD || !FMath::IsNearlyEqual(LastCapsuleHalfHeight, CapsuleHalfHeight))
|
||||
{
|
||||
owningVRChar->NetSmoother->SetRelativeLocation(GetTargetHeightOffset(), false, nullptr, ETeleportType::TeleportPhysics);
|
||||
|
||||
@@ -506,6 +506,8 @@ void UVRRootComponent::TickComponent(float DeltaTime, enum ELevelTick TickType,
|
||||
|
||||
if (IsLocallyControlled())
|
||||
{
|
||||
bool bHadBadTracking = false;
|
||||
|
||||
if (owningVRChar && owningVRChar->bTrackingPaused)
|
||||
{
|
||||
curCameraLoc = owningVRChar->PausedTrackingLoc;
|
||||
@@ -524,6 +526,7 @@ void UVRRootComponent::TickComponent(float DeltaTime, enum ELevelTick TickType,
|
||||
{
|
||||
curCameraLoc = lastCameraLoc;
|
||||
curCameraRot = lastCameraRot;
|
||||
bHadBadTracking = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -562,7 +565,7 @@ void UVRRootComponent::TickComponent(float DeltaTime, enum ELevelTick TickType,
|
||||
|
||||
|
||||
// Can adjust the relative tolerances to remove jitter and some update processing
|
||||
if (!bRetainRoomscale || (!curCameraLoc.Equals(lastCameraLoc, 0.01f) || !curCameraRot.Equals(lastCameraRot, 0.01f)))
|
||||
if (!bHadBadTracking && (!bRetainRoomscale || (!curCameraLoc.Equals(lastCameraLoc, 0.01f) || !curCameraRot.Equals(lastCameraRot, 0.01f))))
|
||||
{
|
||||
// Also calculate vector of movement for the movement component
|
||||
FVector LastPosition = OffsetComponentToWorld.GetLocation();
|
||||
@@ -591,9 +594,23 @@ void UVRRootComponent::TickComponent(float DeltaTime, enum ELevelTick TickType,
|
||||
Params.bFindInitialOverlaps = true;
|
||||
bool bBlockingHit = false;
|
||||
|
||||
if (bUseWalkingCollisionOverride && bRetainRoomscale)
|
||||
if (bUseWalkingCollisionOverride /* && bRetainRoomscale*/)
|
||||
{
|
||||
FVector TargetWorldLocation = OffsetComponentToWorld.GetLocation();
|
||||
FVector TargetWorldLocation = FVector::ZeroVector;
|
||||
|
||||
if (bRetainRoomscale)
|
||||
{
|
||||
TargetWorldLocation = OffsetComponentToWorld.GetLocation();
|
||||
}
|
||||
else // Not Retained Roomscale
|
||||
{
|
||||
FVector NewLocation = StoredCameraRotOffset.RotateVector(FVector(VRCapsuleOffset.X, VRCapsuleOffset.Y, 0.0f)) + curCameraLoc;
|
||||
FVector PlanerLocation = NewLocation - lastCameraLoc;
|
||||
PlanerLocation.Z = 0.0f;
|
||||
DifferenceFromLastFrame = GetComponentTransform().TransformVector(PlanerLocation);
|
||||
TargetWorldLocation = LastPosition + DifferenceFromLastFrame;
|
||||
}
|
||||
|
||||
bool bAllowWalkingCollision = false;
|
||||
if (CharMove != nullptr)
|
||||
{
|
||||
@@ -638,7 +655,6 @@ void UVRRootComponent::TickComponent(float DeltaTime, enum ELevelTick TickType,
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// Run this first so we get full fidelity on the relative space calculation
|
||||
FVector NewLocation = StoredCameraRotOffset.RotateVector(FVector(VRCapsuleOffset.X, VRCapsuleOffset.Y, 0.0f)) + curCameraLoc;
|
||||
FVector PlanerLocation = NewLocation - lastCameraLoc;
|
||||
@@ -1537,7 +1553,7 @@ bool UVRRootComponent::IsLocallyControlled() const
|
||||
// Simulated proxies should already have the new height from the server
|
||||
if (!owningVRChar->bRetainRoomscale && (owningVRChar->GetNetMode() < ENetMode::NM_Client || IsLocallyControlled()))
|
||||
{
|
||||
MoveComponent(this->GetComponentQuat().GetUpVector() * (Offset * this->GetComponentScale().Z), GetComponentQuat(), true, nullptr, EMoveComponentFlags::MOVECOMP_NoFlags, ETeleportType::TeleportPhysics);
|
||||
MoveComponent(this->GetComponentQuat().GetUpVector() * (Offset * this->GetComponentScale().Z), GetComponentQuat(), false, nullptr, EMoveComponentFlags::MOVECOMP_NoFlags, ETeleportType::TeleportPhysics);
|
||||
}
|
||||
/*else
|
||||
{
|
||||
@@ -1545,7 +1561,7 @@ bool UVRRootComponent::IsLocallyControlled() const
|
||||
GenerateOffsetToWorld();
|
||||
}*/
|
||||
|
||||
if (!owningVRChar->bRetainRoomscale && !IsLocallyControlled())
|
||||
if (!owningVRChar->bRetainRoomscale && !IsLocallyControlled() && !IsNetMode(NM_DedicatedServer))
|
||||
{
|
||||
// Don't smooth this change in mesh position
|
||||
FNetworkPredictionData_Client_Character* ClientData = owningVRChar->GetCharacterMovement()->GetPredictionData_Client_Character();
|
||||
|
||||
+10
-1
@@ -415,6 +415,8 @@ UVRStereoWidgetComponent::~UVRStereoWidgetComponent()
|
||||
|
||||
void UVRStereoWidgetComponent::EndPlay(const EEndPlayReason::Type EndPlayReason)
|
||||
{
|
||||
Super::EndPlay(EndPlayReason);
|
||||
|
||||
if (EndPlayReason == EEndPlayReason::EndPlayInEditor || EndPlayReason == EEndPlayReason::Quit)
|
||||
{
|
||||
//FStereoLayerAdditionalFlagsManager::Destroy();
|
||||
@@ -601,7 +603,14 @@ void UVRStereoWidgetComponent::TickComponent(float DeltaTime, enum ELevelTick Ti
|
||||
|
||||
if (AVRCharacter* VRChar = Cast<AVRCharacter>(mpawn))
|
||||
{
|
||||
HMDLoc += UVRExpansionFunctionLibrary::GetHMDPureYaw_I(HMDRot.Rotator()).RotateVector(FVector(VRChar->VRRootReference->VRCapsuleOffset.X, VRChar->VRRootReference->VRCapsuleOffset.Y, 0.0f));
|
||||
if (VRChar->VRMovementReference && VRChar->VRMovementReference->GetReplicatedMovementMode() == EVRConjoinedMovementModes::C_VRMOVE_Seated)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
HMDLoc += UVRExpansionFunctionLibrary::GetHMDPureYaw_I(HMDRot.Rotator()).RotateVector(FVector(VRChar->VRRootReference->VRCapsuleOffset.X, VRChar->VRRootReference->VRCapsuleOffset.Y, 0.0f));
|
||||
}
|
||||
}
|
||||
|
||||
DeltaTrans = FTransform(FQuat::Identity, HMDLoc, FVector(1.0f));
|
||||
|
||||
+1
-1
@@ -465,7 +465,7 @@ public:
|
||||
#if WITH_EDITORONLY_DATA
|
||||
// Material to apply to the hand
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Hand Visualization")
|
||||
TObjectPtr<UMaterial> HandPreviewMaterial;
|
||||
TObjectPtr<UMaterialInterface> HandPreviewMaterial;
|
||||
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -13,6 +13,40 @@
|
||||
#include "VRWheeledVehicle.generated.h"
|
||||
|
||||
|
||||
// This only exists to expose the blueprint properties of the transmission values
|
||||
USTRUCT(BlueprintType, Category = "VRWheeledVehicle")
|
||||
struct VREXPANSIONPLUGIN_API FBPVehicleTransmissionConfig : public FVehicleTransmissionConfig
|
||||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
|
||||
void SetFrom(FVehicleTransmissionConfig & Config)
|
||||
{
|
||||
bUseAutomaticGears = Config.bUseAutomaticGears;
|
||||
bUseAutoReverse = Config.bUseAutoReverse;
|
||||
FinalRatio = Config.FinalRatio;
|
||||
ForwardGearRatios = Config.ForwardGearRatios;
|
||||
ReverseGearRatios = Config.ReverseGearRatios;
|
||||
ChangeUpRPM = Config.ChangeUpRPM;
|
||||
ChangeDownRPM = Config.ChangeDownRPM;
|
||||
GearChangeTime = Config.GearChangeTime;
|
||||
TransmissionEfficiency = Config.TransmissionEfficiency;
|
||||
}
|
||||
|
||||
void SetTo(FVehicleTransmissionConfig& Config)
|
||||
{
|
||||
Config.bUseAutomaticGears = bUseAutomaticGears;
|
||||
Config.bUseAutoReverse = bUseAutoReverse;
|
||||
Config.FinalRatio = FinalRatio;
|
||||
Config.ForwardGearRatios = ForwardGearRatios;
|
||||
Config.ReverseGearRatios = ReverseGearRatios;
|
||||
Config.ChangeUpRPM = ChangeUpRPM;
|
||||
Config.ChangeDownRPM = ChangeDownRPM;
|
||||
Config.GearChangeTime = GearChangeTime;
|
||||
Config.TransmissionEfficiency = TransmissionEfficiency;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This override of the base wheeled vehicle allows for dual pawn usage in engine.
|
||||
*/
|
||||
@@ -24,6 +58,29 @@ class VREXPANSIONPLUGIN_API AVRWheeledVehicle : public AWheeledVehiclePawn
|
||||
|
||||
public:
|
||||
|
||||
|
||||
UFUNCTION(BlueprintPure, Category = "Pawn")
|
||||
float GetFinalGearRatio()
|
||||
{
|
||||
float CurrentGearRatio = 0.0f;
|
||||
if (UChaosWheeledVehicleMovementComponent* MoveComp = Cast<UChaosWheeledVehicleMovementComponent>(this->GetMovementComponent()))
|
||||
{
|
||||
CurrentGearRatio = MoveComp->TransmissionSetup.FinalRatio;
|
||||
}
|
||||
|
||||
return CurrentGearRatio;
|
||||
}
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "Pawn")
|
||||
void SetFinalGearRatio(float NewFinalGearRatio)
|
||||
{
|
||||
if (UChaosWheeledVehicleMovementComponent* MoveComp = Cast<UChaosWheeledVehicleMovementComponent>(this->GetMovementComponent()))
|
||||
{
|
||||
MoveComp->TransmissionSetup.FinalRatio = NewFinalGearRatio;
|
||||
}
|
||||
}
|
||||
|
||||
// Calls the movement components override controller function
|
||||
UFUNCTION(BlueprintCallable, Category = "Pawn")
|
||||
virtual bool SetBindToInput(AController * CController, bool bBindToInput)
|
||||
{
|
||||
|
||||
+1
-2
@@ -137,8 +137,7 @@ public:
|
||||
FQuat GetCalculatedRotation(FRotator InverseRot, float DeltaTime)
|
||||
{
|
||||
FRotator FinalRot = FRotator::ZeroRotator;
|
||||
|
||||
if (FPlatformMath::Abs(FRotator::ClampAxis(InverseRot.Yaw) - LastRot) < YawTolerance) // This is never true with the default value of 0.0f
|
||||
if (FPlatformMath::Abs(FMath::FindDeltaAngleDegrees(InverseRot.Yaw, LastRot)) < YawTolerance) // This is never true with the default value of 0.0f
|
||||
{
|
||||
if (!bWasSetOnce)
|
||||
{
|
||||
|
||||
@@ -1562,6 +1562,8 @@ public:
|
||||
|
||||
UPrimitiveComponent* GetGrippedComponent() const;
|
||||
|
||||
UPrimitiveComponent* GetGripPrimitiveComponent() const;
|
||||
|
||||
//Check if a grip is the same as another, the only things I check for are the actor / component
|
||||
//This is here for the Find() function from TArray
|
||||
FORCEINLINE bool operator==(const FBPActorGripInformation &Other) const
|
||||
|
||||
@@ -200,6 +200,10 @@ public:
|
||||
UFUNCTION(BlueprintPure, Category = "VRExpansionFunctions")
|
||||
static bool IsActiveGrip(const FBPActorGripInformation& Grip);
|
||||
|
||||
/* Returns the target primitive component if the grip has one (it should always), otherwise it will return invalid */
|
||||
UFUNCTION(BlueprintPure, Category = "VRExpansionFunctions")
|
||||
static UPrimitiveComponent* GetGripPrimitiveTarget(const FBPActorGripInformation& Grip);
|
||||
|
||||
/** Make a transform net quantize from location, rotation and scale */
|
||||
UFUNCTION(BlueprintPure, meta = (Scale = "1,1,1", Keywords = "construct build", NativeMakeFunc), Category = "VRExpansionLibrary|TransformNetQuantize")
|
||||
static FTransform_NetQuantize MakeTransform_NetQuantize(FVector Location, FRotator Rotation, FVector Scale);
|
||||
|
||||
@@ -57,7 +57,14 @@ public:
|
||||
inline FVector GetTargetHeightOffset()
|
||||
{
|
||||
//return FVector::ZeroVector;
|
||||
return FVector(0.f, 0.f, (-this->GetUnscaledCapsuleHalfHeight()) - VRCapsuleOffset.Z);
|
||||
if (bCenterCapsuleOnHMD)
|
||||
{
|
||||
return FVector(0.f, 0.f, (-VRCapsuleOffset.Z) - curCameraLoc.Z);
|
||||
}
|
||||
else
|
||||
{
|
||||
return FVector(0.f, 0.f, (-this->GetUnscaledCapsuleHalfHeight()) - VRCapsuleOffset.Z);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -266,7 +273,7 @@ void inline UVRRootComponent::GenerateOffsetToWorld(bool bUpdateBounds, bool bGe
|
||||
|
||||
if(owningVRChar && !owningVRChar->bRetainRoomscale)
|
||||
{
|
||||
OffsetComponentToWorld = FTransform(CamRotOffset.Quaternion(), FVector(0.0f, 0.0f, bCenterCapsuleOnHMD ? curCameraLoc.Z : 0.0f), FVector(1.0f)) * GetComponentTransform();
|
||||
OffsetComponentToWorld = FTransform(CamRotOffset.Quaternion(), FVector(0.0f, 0.0f, 0.0f), FVector(1.0f)) * GetComponentTransform();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user