Update VRE, Fix broken Asset
This commit is contained in:
parent
9eeb6901d4
commit
d0229c6c2c
9 changed files with 97 additions and 356 deletions
BIN
VIRTUOS_ExpansionPluginTests/Content/VRE/Core/Character/BP_VRCharacter.uasset
(Stored with Git LFS)
BIN
VIRTUOS_ExpansionPluginTests/Content/VRE/Core/Character/BP_VRCharacter.uasset
(Stored with Git LFS)
Binary file not shown.
|
@ -8334,12 +8334,12 @@ void UGripMotionControllerComponent::GetHandType(EControllerHand& Hand)
|
||||||
{
|
{
|
||||||
// Check if the palm motion source extension is being used
|
// Check if the palm motion source extension is being used
|
||||||
// I assume eventually epic will handle this case
|
// 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;
|
Hand = EControllerHand::Right;
|
||||||
}
|
}
|
||||||
// Could skip this and default to left now but would rather check
|
// 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;
|
Hand = EControllerHand::Left;
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,10 +129,16 @@ void AGrippableActor::PreReplication(IRepChangedPropertyTracker & ChangedPropert
|
||||||
|
|
||||||
void AGrippableActor::GatherCurrentMovement()
|
void AGrippableActor::GatherCurrentMovement()
|
||||||
{
|
{
|
||||||
if (IsReplicatingMovement() || (RootComponent && RootComponent->GetAttachParent()))
|
Super::GatherCurrentMovement();
|
||||||
|
|
||||||
|
FRepMovement RepMovement = GetReplicatedMovement();
|
||||||
|
if (RootComponent && (!RepMovement.bRepPhysics || RootComponent->GetAttachParent()))
|
||||||
|
{
|
||||||
|
UPrimitiveComponent* RootPrimComp = Cast<UPrimitiveComponent>(GetRootComponent());
|
||||||
|
|
||||||
|
if (!RepMovement.bRepPhysics || (!RootPrimComp || !RootPrimComp->IsSimulatingPhysics()))
|
||||||
{
|
{
|
||||||
bool bWasAttachmentModified = false;
|
bool bWasAttachmentModified = false;
|
||||||
bool bWasRepMovementModified = false;
|
|
||||||
|
|
||||||
AActor* OldAttachParent = AttachmentWeldReplication.AttachParent;
|
AActor* OldAttachParent = AttachmentWeldReplication.AttachParent;
|
||||||
USceneComponent* OldAttachComponent = AttachmentWeldReplication.AttachComponent;
|
USceneComponent* OldAttachComponent = AttachmentWeldReplication.AttachComponent;
|
||||||
|
@ -140,85 +146,6 @@ void AGrippableActor::GatherCurrentMovement()
|
||||||
AttachmentWeldReplication.AttachParent = nullptr;
|
AttachmentWeldReplication.AttachParent = nullptr;
|
||||||
AttachmentWeldReplication.AttachComponent = nullptr;
|
AttachmentWeldReplication.AttachComponent = nullptr;
|
||||||
|
|
||||||
FRepMovement& RepMovement = GetReplicatedMovement_Mutable();
|
|
||||||
|
|
||||||
UPrimitiveComponent* RootPrimComp = Cast<UPrimitiveComponent>(GetRootComponent());
|
|
||||||
if (RootPrimComp && RootPrimComp->IsSimulatingPhysics())
|
|
||||||
{
|
|
||||||
#if UE_WITH_IRIS
|
|
||||||
const bool bPrevRepPhysics = GetReplicatedMovement_Mutable().bRepPhysics;
|
|
||||||
#endif // UE_WITH_IRIS
|
|
||||||
|
|
||||||
bool bFoundInCache = false;
|
|
||||||
|
|
||||||
UWorld* World = GetWorld();
|
|
||||||
|
|
||||||
const bool bShouldUsePhysicsReplicationCache = GetPhysicsReplicationMode() != EPhysicsReplicationMode::Default;
|
|
||||||
int ServerFrame = 0;
|
|
||||||
|
|
||||||
if (bShouldUsePhysicsReplicationCache)
|
|
||||||
{
|
|
||||||
if (FPhysScene_Chaos* Scene = static_cast<FPhysScene_Chaos*>(World->GetPhysicsScene()))
|
|
||||||
{
|
|
||||||
if (const FRigidBodyState* FoundState = Scene->GetStateFromReplicationCache(RootPrimComp, /*OUT*/ServerFrame))
|
|
||||||
{
|
|
||||||
if (RepMovement.ServerFrame != ServerFrame)
|
|
||||||
{
|
|
||||||
RepMovement.FillFrom(*FoundState, this, ServerFrame);
|
|
||||||
bWasRepMovementModified = true;
|
|
||||||
}
|
|
||||||
bFoundInCache = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!bFoundInCache)
|
|
||||||
{
|
|
||||||
// fallback to GT data
|
|
||||||
FRigidBodyState RBState;
|
|
||||||
RootPrimComp->GetRigidBodyState(RBState);
|
|
||||||
RepMovement.FillFrom(RBState, this, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Don't replicate movement if we're welded to another parent actor.
|
|
||||||
// Their replication will affect our position indirectly since we are attached.
|
|
||||||
RepMovement.bRepPhysics = !RootPrimComp->IsWelded();
|
|
||||||
|
|
||||||
if (!RepMovement.bRepPhysics)
|
|
||||||
{
|
|
||||||
if (RootComponent->GetAttachParent() != nullptr)
|
|
||||||
{
|
|
||||||
// Networking for attachments assumes the RootComponent of the AttachParent actor.
|
|
||||||
// If that's not the case, we can't update this, as the client wouldn't be able to resolve the Component and would detach as a result.
|
|
||||||
AttachmentWeldReplication.AttachParent = RootComponent->GetAttachParent()->GetAttachmentRootActor();
|
|
||||||
if (AttachmentWeldReplication.AttachParent != nullptr)
|
|
||||||
{
|
|
||||||
AttachmentWeldReplication.LocationOffset = RootComponent->GetRelativeLocation();
|
|
||||||
AttachmentWeldReplication.RotationOffset = RootComponent->GetRelativeRotation();
|
|
||||||
AttachmentWeldReplication.RelativeScale3D = RootComponent->GetRelativeScale3D();
|
|
||||||
AttachmentWeldReplication.AttachComponent = RootComponent->GetAttachParent();
|
|
||||||
AttachmentWeldReplication.AttachSocket = RootComponent->GetAttachSocketName();
|
|
||||||
AttachmentWeldReplication.bIsWelded = RootPrimComp ? RootPrimComp->IsWelded() : false;
|
|
||||||
|
|
||||||
// Technically, the values might have stayed the same, but we'll just assume they've changed.
|
|
||||||
bWasAttachmentModified = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Technically, the values might have stayed the same, but we'll just assume they've changed.
|
|
||||||
bWasRepMovementModified = true;
|
|
||||||
|
|
||||||
#if UE_WITH_IRIS
|
|
||||||
// If RepPhysics has changed value then notify the ReplicationSystem
|
|
||||||
if (bPrevRepPhysics != GetReplicatedMovement_Mutable().bRepPhysics)
|
|
||||||
{
|
|
||||||
UpdateReplicatePhysicsCondition();
|
|
||||||
}
|
|
||||||
#endif // UE_WITH_IRIS
|
|
||||||
}
|
|
||||||
else if (RootComponent != nullptr)
|
|
||||||
{
|
|
||||||
// If we are attached, don't replicate absolute position, use AttachmentReplication instead.
|
// If we are attached, don't replicate absolute position, use AttachmentReplication instead.
|
||||||
if (RootComponent->GetAttachParent() != nullptr)
|
if (RootComponent->GetAttachParent() != nullptr)
|
||||||
{
|
{
|
||||||
|
@ -238,35 +165,17 @@ void AGrippableActor::GatherCurrentMovement()
|
||||||
bWasAttachmentModified = true;
|
bWasAttachmentModified = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
RepMovement.Location = FRepMovement::RebaseOntoZeroOrigin(RootComponent->GetComponentLocation(), this);
|
|
||||||
RepMovement.Rotation = RootComponent->GetComponentRotation();
|
|
||||||
RepMovement.LinearVelocity = GetVelocity();
|
|
||||||
RepMovement.AngularVelocity = FVector::ZeroVector;
|
|
||||||
|
|
||||||
// Technically, the values might have stayed the same, but we'll just assume they've changed.
|
|
||||||
bWasRepMovementModified = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bWasRepMovementModified = (bWasRepMovementModified || RepMovement.bRepPhysics);
|
|
||||||
RepMovement.bRepPhysics = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if WITH_PUSH_MODEL
|
|
||||||
if (bWasRepMovementModified)
|
|
||||||
{
|
|
||||||
MARK_PROPERTY_DIRTY_FROM_NAME(AActor, ReplicatedMovement, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bWasAttachmentModified ||
|
if (bWasAttachmentModified ||
|
||||||
OldAttachParent != AttachmentWeldReplication.AttachParent ||
|
OldAttachParent != AttachmentWeldReplication.AttachParent ||
|
||||||
OldAttachComponent != AttachmentWeldReplication.AttachComponent)
|
OldAttachComponent != AttachmentWeldReplication.AttachComponent)
|
||||||
{
|
{
|
||||||
|
#if WITH_PUSH_MODEL
|
||||||
MARK_PROPERTY_DIRTY_FROM_NAME(AGrippableActor, AttachmentWeldReplication, this);
|
MARK_PROPERTY_DIRTY_FROM_NAME(AGrippableActor, AttachmentWeldReplication, this);
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AGrippableActor::ShouldWeSkipAttachmentReplication(bool bConsiderHeld) const
|
bool AGrippableActor::ShouldWeSkipAttachmentReplication(bool bConsiderHeld) const
|
||||||
|
|
|
@ -233,10 +233,16 @@ void AGrippableSkeletalMeshActor::PreReplication(IRepChangedPropertyTracker& Cha
|
||||||
|
|
||||||
void AGrippableSkeletalMeshActor::GatherCurrentMovement()
|
void AGrippableSkeletalMeshActor::GatherCurrentMovement()
|
||||||
{
|
{
|
||||||
if (IsReplicatingMovement() || (RootComponent && RootComponent->GetAttachParent()))
|
Super::GatherCurrentMovement();
|
||||||
|
|
||||||
|
FRepMovement RepMovement = GetReplicatedMovement();
|
||||||
|
if (RootComponent && (!RepMovement.bRepPhysics || RootComponent->GetAttachParent()))
|
||||||
|
{
|
||||||
|
UPrimitiveComponent* RootPrimComp = Cast<UPrimitiveComponent>(GetRootComponent());
|
||||||
|
|
||||||
|
if (!RepMovement.bRepPhysics || (!RootPrimComp || !RootPrimComp->IsSimulatingPhysics()))
|
||||||
{
|
{
|
||||||
bool bWasAttachmentModified = false;
|
bool bWasAttachmentModified = false;
|
||||||
bool bWasRepMovementModified = false;
|
|
||||||
|
|
||||||
AActor* OldAttachParent = AttachmentWeldReplication.AttachParent;
|
AActor* OldAttachParent = AttachmentWeldReplication.AttachParent;
|
||||||
USceneComponent* OldAttachComponent = AttachmentWeldReplication.AttachComponent;
|
USceneComponent* OldAttachComponent = AttachmentWeldReplication.AttachComponent;
|
||||||
|
@ -244,85 +250,6 @@ void AGrippableSkeletalMeshActor::GatherCurrentMovement()
|
||||||
AttachmentWeldReplication.AttachParent = nullptr;
|
AttachmentWeldReplication.AttachParent = nullptr;
|
||||||
AttachmentWeldReplication.AttachComponent = nullptr;
|
AttachmentWeldReplication.AttachComponent = nullptr;
|
||||||
|
|
||||||
FRepMovement& RepMovement = GetReplicatedMovement_Mutable();
|
|
||||||
|
|
||||||
UPrimitiveComponent* RootPrimComp = Cast<UPrimitiveComponent>(GetRootComponent());
|
|
||||||
if (RootPrimComp && RootPrimComp->IsSimulatingPhysics())
|
|
||||||
{
|
|
||||||
#if UE_WITH_IRIS
|
|
||||||
const bool bPrevRepPhysics = GetReplicatedMovement_Mutable().bRepPhysics;
|
|
||||||
#endif // UE_WITH_IRIS
|
|
||||||
|
|
||||||
bool bFoundInCache = false;
|
|
||||||
|
|
||||||
UWorld* World = GetWorld();
|
|
||||||
|
|
||||||
const bool bShouldUsePhysicsReplicationCache = GetPhysicsReplicationMode() != EPhysicsReplicationMode::Default;
|
|
||||||
int ServerFrame = 0;
|
|
||||||
|
|
||||||
if (bShouldUsePhysicsReplicationCache)
|
|
||||||
{
|
|
||||||
if (FPhysScene_Chaos* Scene = static_cast<FPhysScene_Chaos*>(World->GetPhysicsScene()))
|
|
||||||
{
|
|
||||||
if (const FRigidBodyState* FoundState = Scene->GetStateFromReplicationCache(RootPrimComp, /*OUT*/ServerFrame))
|
|
||||||
{
|
|
||||||
if (RepMovement.ServerFrame != ServerFrame)
|
|
||||||
{
|
|
||||||
RepMovement.FillFrom(*FoundState, this, ServerFrame);
|
|
||||||
bWasRepMovementModified = true;
|
|
||||||
}
|
|
||||||
bFoundInCache = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!bFoundInCache)
|
|
||||||
{
|
|
||||||
// fallback to GT data
|
|
||||||
FRigidBodyState RBState;
|
|
||||||
RootPrimComp->GetRigidBodyState(RBState);
|
|
||||||
RepMovement.FillFrom(RBState, this, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Don't replicate movement if we're welded to another parent actor.
|
|
||||||
// Their replication will affect our position indirectly since we are attached.
|
|
||||||
RepMovement.bRepPhysics = !RootPrimComp->IsWelded();
|
|
||||||
|
|
||||||
if (!RepMovement.bRepPhysics)
|
|
||||||
{
|
|
||||||
if (RootComponent->GetAttachParent() != nullptr)
|
|
||||||
{
|
|
||||||
// Networking for attachments assumes the RootComponent of the AttachParent actor.
|
|
||||||
// If that's not the case, we can't update this, as the client wouldn't be able to resolve the Component and would detach as a result.
|
|
||||||
AttachmentWeldReplication.AttachParent = RootComponent->GetAttachParent()->GetAttachmentRootActor();
|
|
||||||
if (AttachmentWeldReplication.AttachParent != nullptr)
|
|
||||||
{
|
|
||||||
AttachmentWeldReplication.LocationOffset = RootComponent->GetRelativeLocation();
|
|
||||||
AttachmentWeldReplication.RotationOffset = RootComponent->GetRelativeRotation();
|
|
||||||
AttachmentWeldReplication.RelativeScale3D = RootComponent->GetRelativeScale3D();
|
|
||||||
AttachmentWeldReplication.AttachComponent = RootComponent->GetAttachParent();
|
|
||||||
AttachmentWeldReplication.AttachSocket = RootComponent->GetAttachSocketName();
|
|
||||||
AttachmentWeldReplication.bIsWelded = RootPrimComp ? RootPrimComp->IsWelded() : false;
|
|
||||||
|
|
||||||
// Technically, the values might have stayed the same, but we'll just assume they've changed.
|
|
||||||
bWasAttachmentModified = true;
|
|
||||||
|
|
||||||
#if UE_WITH_IRIS
|
|
||||||
// If RepPhysics has changed value then notify the ReplicationSystem
|
|
||||||
if (bPrevRepPhysics != GetReplicatedMovement_Mutable().bRepPhysics)
|
|
||||||
{
|
|
||||||
UpdateReplicatePhysicsCondition();
|
|
||||||
}
|
|
||||||
#endif // UE_WITH_IRIS
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Technically, the values might have stayed the same, but we'll just assume they've changed.
|
|
||||||
bWasRepMovementModified = true;
|
|
||||||
}
|
|
||||||
else if (RootComponent != nullptr)
|
|
||||||
{
|
|
||||||
// If we are attached, don't replicate absolute position, use AttachmentReplication instead.
|
// If we are attached, don't replicate absolute position, use AttachmentReplication instead.
|
||||||
if (RootComponent->GetAttachParent() != nullptr)
|
if (RootComponent->GetAttachParent() != nullptr)
|
||||||
{
|
{
|
||||||
|
@ -342,34 +269,17 @@ void AGrippableSkeletalMeshActor::GatherCurrentMovement()
|
||||||
bWasAttachmentModified = true;
|
bWasAttachmentModified = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
RepMovement.Location = FRepMovement::RebaseOntoZeroOrigin(RootComponent->GetComponentLocation(), this);
|
|
||||||
RepMovement.Rotation = RootComponent->GetComponentRotation();
|
|
||||||
RepMovement.LinearVelocity = GetVelocity();
|
|
||||||
RepMovement.AngularVelocity = FVector::ZeroVector;
|
|
||||||
|
|
||||||
// Technically, the values might have stayed the same, but we'll just assume they've changed.
|
|
||||||
bWasRepMovementModified = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bWasRepMovementModified = (bWasRepMovementModified || RepMovement.bRepPhysics);
|
|
||||||
RepMovement.bRepPhysics = false;
|
|
||||||
}
|
|
||||||
#if WITH_PUSH_MODEL
|
|
||||||
if (bWasRepMovementModified)
|
|
||||||
{
|
|
||||||
MARK_PROPERTY_DIRTY_FROM_NAME(AActor, ReplicatedMovement, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bWasAttachmentModified ||
|
if (bWasAttachmentModified ||
|
||||||
OldAttachParent != AttachmentWeldReplication.AttachParent ||
|
OldAttachParent != AttachmentWeldReplication.AttachParent ||
|
||||||
OldAttachComponent != AttachmentWeldReplication.AttachComponent)
|
OldAttachComponent != AttachmentWeldReplication.AttachComponent)
|
||||||
{
|
{
|
||||||
|
#if WITH_PUSH_MODEL
|
||||||
MARK_PROPERTY_DIRTY_FROM_NAME(AGrippableSkeletalMeshActor, AttachmentWeldReplication, this);
|
MARK_PROPERTY_DIRTY_FROM_NAME(AGrippableSkeletalMeshActor, AttachmentWeldReplication, this);
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AGrippableSkeletalMeshActor::ReplicateSubobjects(UActorChannel* Channel, class FOutBunch* Bunch, FReplicationFlags* RepFlags)
|
bool AGrippableSkeletalMeshActor::ReplicateSubobjects(UActorChannel* Channel, class FOutBunch* Bunch, FReplicationFlags* RepFlags)
|
||||||
|
|
|
@ -180,10 +180,16 @@ void AGrippableStaticMeshActor::PreReplication(IRepChangedPropertyTracker & Chan
|
||||||
|
|
||||||
void AGrippableStaticMeshActor::GatherCurrentMovement()
|
void AGrippableStaticMeshActor::GatherCurrentMovement()
|
||||||
{
|
{
|
||||||
if (IsReplicatingMovement() || (RootComponent && RootComponent->GetAttachParent()))
|
Super::GatherCurrentMovement();
|
||||||
|
|
||||||
|
FRepMovement RepMovement = GetReplicatedMovement();
|
||||||
|
if (RootComponent && (!RepMovement.bRepPhysics || RootComponent->GetAttachParent()))
|
||||||
|
{
|
||||||
|
UPrimitiveComponent* RootPrimComp = Cast<UPrimitiveComponent>(GetRootComponent());
|
||||||
|
|
||||||
|
if (!RepMovement.bRepPhysics || (!RootPrimComp || !RootPrimComp->IsSimulatingPhysics()))
|
||||||
{
|
{
|
||||||
bool bWasAttachmentModified = false;
|
bool bWasAttachmentModified = false;
|
||||||
bool bWasRepMovementModified = false;
|
|
||||||
|
|
||||||
AActor* OldAttachParent = AttachmentWeldReplication.AttachParent;
|
AActor* OldAttachParent = AttachmentWeldReplication.AttachParent;
|
||||||
USceneComponent* OldAttachComponent = AttachmentWeldReplication.AttachComponent;
|
USceneComponent* OldAttachComponent = AttachmentWeldReplication.AttachComponent;
|
||||||
|
@ -191,85 +197,6 @@ void AGrippableStaticMeshActor::GatherCurrentMovement()
|
||||||
AttachmentWeldReplication.AttachParent = nullptr;
|
AttachmentWeldReplication.AttachParent = nullptr;
|
||||||
AttachmentWeldReplication.AttachComponent = nullptr;
|
AttachmentWeldReplication.AttachComponent = nullptr;
|
||||||
|
|
||||||
FRepMovement& RepMovement = GetReplicatedMovement_Mutable();
|
|
||||||
|
|
||||||
UPrimitiveComponent* RootPrimComp = Cast<UPrimitiveComponent>(GetRootComponent());
|
|
||||||
if (RootPrimComp && RootPrimComp->IsSimulatingPhysics())
|
|
||||||
{
|
|
||||||
#if UE_WITH_IRIS
|
|
||||||
const bool bPrevRepPhysics = GetReplicatedMovement_Mutable().bRepPhysics;
|
|
||||||
#endif // UE_WITH_IRIS
|
|
||||||
|
|
||||||
bool bFoundInCache = false;
|
|
||||||
|
|
||||||
UWorld* World = GetWorld();
|
|
||||||
|
|
||||||
const bool bShouldUsePhysicsReplicationCache = GetPhysicsReplicationMode() != EPhysicsReplicationMode::Default;
|
|
||||||
int ServerFrame = 0;
|
|
||||||
|
|
||||||
if (bShouldUsePhysicsReplicationCache)
|
|
||||||
{
|
|
||||||
if (FPhysScene_Chaos* Scene = static_cast<FPhysScene_Chaos*>(World->GetPhysicsScene()))
|
|
||||||
{
|
|
||||||
if (const FRigidBodyState* FoundState = Scene->GetStateFromReplicationCache(RootPrimComp, /*OUT*/ServerFrame))
|
|
||||||
{
|
|
||||||
if (RepMovement.ServerFrame != ServerFrame)
|
|
||||||
{
|
|
||||||
RepMovement.FillFrom(*FoundState, this, ServerFrame);
|
|
||||||
bWasRepMovementModified = true;
|
|
||||||
}
|
|
||||||
bFoundInCache = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!bFoundInCache)
|
|
||||||
{
|
|
||||||
// fallback to GT data
|
|
||||||
FRigidBodyState RBState;
|
|
||||||
RootPrimComp->GetRigidBodyState(RBState);
|
|
||||||
RepMovement.FillFrom(RBState, this, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Don't replicate movement if we're welded to another parent actor.
|
|
||||||
// Their replication will affect our position indirectly since we are attached.
|
|
||||||
RepMovement.bRepPhysics = !RootPrimComp->IsWelded();
|
|
||||||
|
|
||||||
if (!RepMovement.bRepPhysics)
|
|
||||||
{
|
|
||||||
if (RootComponent->GetAttachParent() != nullptr)
|
|
||||||
{
|
|
||||||
// Networking for attachments assumes the RootComponent of the AttachParent actor.
|
|
||||||
// If that's not the case, we can't update this, as the client wouldn't be able to resolve the Component and would detach as a result.
|
|
||||||
AttachmentWeldReplication.AttachParent = RootComponent->GetAttachParent()->GetAttachmentRootActor();
|
|
||||||
if (AttachmentWeldReplication.AttachParent != nullptr)
|
|
||||||
{
|
|
||||||
AttachmentWeldReplication.LocationOffset = RootComponent->GetRelativeLocation();
|
|
||||||
AttachmentWeldReplication.RotationOffset = RootComponent->GetRelativeRotation();
|
|
||||||
AttachmentWeldReplication.RelativeScale3D = RootComponent->GetRelativeScale3D();
|
|
||||||
AttachmentWeldReplication.AttachComponent = RootComponent->GetAttachParent();
|
|
||||||
AttachmentWeldReplication.AttachSocket = RootComponent->GetAttachSocketName();
|
|
||||||
AttachmentWeldReplication.bIsWelded = RootPrimComp ? RootPrimComp->IsWelded() : false;
|
|
||||||
|
|
||||||
// Technically, the values might have stayed the same, but we'll just assume they've changed.
|
|
||||||
bWasAttachmentModified = true;
|
|
||||||
|
|
||||||
#if UE_WITH_IRIS
|
|
||||||
// If RepPhysics has changed value then notify the ReplicationSystem
|
|
||||||
if (bPrevRepPhysics != GetReplicatedMovement_Mutable().bRepPhysics)
|
|
||||||
{
|
|
||||||
UpdateReplicatePhysicsCondition();
|
|
||||||
}
|
|
||||||
#endif // UE_WITH_IRIS
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Technically, the values might have stayed the same, but we'll just assume they've changed.
|
|
||||||
bWasRepMovementModified = true;
|
|
||||||
}
|
|
||||||
else if (RootComponent != nullptr)
|
|
||||||
{
|
|
||||||
// If we are attached, don't replicate absolute position, use AttachmentReplication instead.
|
// If we are attached, don't replicate absolute position, use AttachmentReplication instead.
|
||||||
if (RootComponent->GetAttachParent() != nullptr)
|
if (RootComponent->GetAttachParent() != nullptr)
|
||||||
{
|
{
|
||||||
|
@ -289,34 +216,17 @@ void AGrippableStaticMeshActor::GatherCurrentMovement()
|
||||||
bWasAttachmentModified = true;
|
bWasAttachmentModified = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
RepMovement.Location = FRepMovement::RebaseOntoZeroOrigin(RootComponent->GetComponentLocation(), this);
|
|
||||||
RepMovement.Rotation = RootComponent->GetComponentRotation();
|
|
||||||
RepMovement.LinearVelocity = GetVelocity();
|
|
||||||
RepMovement.AngularVelocity = FVector::ZeroVector;
|
|
||||||
|
|
||||||
// Technically, the values might have stayed the same, but we'll just assume they've changed.
|
|
||||||
bWasRepMovementModified = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bWasRepMovementModified = (bWasRepMovementModified || RepMovement.bRepPhysics);
|
|
||||||
RepMovement.bRepPhysics = false;
|
|
||||||
}
|
|
||||||
#if WITH_PUSH_MODEL
|
|
||||||
if (bWasRepMovementModified)
|
|
||||||
{
|
|
||||||
MARK_PROPERTY_DIRTY_FROM_NAME(AActor, ReplicatedMovement, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bWasAttachmentModified ||
|
if (bWasAttachmentModified ||
|
||||||
OldAttachParent != AttachmentWeldReplication.AttachParent ||
|
OldAttachParent != AttachmentWeldReplication.AttachParent ||
|
||||||
OldAttachComponent != AttachmentWeldReplication.AttachComponent)
|
OldAttachComponent != AttachmentWeldReplication.AttachComponent)
|
||||||
{
|
{
|
||||||
|
#if WITH_PUSH_MODEL
|
||||||
MARK_PROPERTY_DIRTY_FROM_NAME(AGrippableStaticMeshActor, AttachmentWeldReplication, this);
|
MARK_PROPERTY_DIRTY_FROM_NAME(AGrippableStaticMeshActor, AttachmentWeldReplication, this);
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AGrippableStaticMeshActor::ReplicateSubobjects(UActorChannel* Channel, class FOutBunch *Bunch, FReplicationFlags *RepFlags)
|
bool AGrippableStaticMeshActor::ReplicateSubobjects(UActorChannel* Channel, class FOutBunch *Bunch, FReplicationFlags *RepFlags)
|
||||||
|
|
|
@ -161,17 +161,14 @@ void UCollisionIgnoreSubsystem::CheckActiveFilters()
|
||||||
{
|
{
|
||||||
bool bMadeChanges = false;
|
bool bMadeChanges = false;
|
||||||
|
|
||||||
for (TPair<FCollisionPrimPair, FCollisionIgnorePairArray>& KeyPair : CollisionTrackedPairs)
|
for (TMap<FCollisionPrimPair, FCollisionIgnorePairArray>::TIterator ItRemove = CollisionTrackedPairs.CreateIterator(); ItRemove; ++ItRemove)
|
||||||
{
|
{
|
||||||
// First check for invalid primitives
|
// First check for invalid primitives and an empty pair array
|
||||||
if (!IsValid(KeyPair.Key.Prim1) || !IsValid(KeyPair.Key.Prim2))
|
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
|
ItRemove->Value.PairArray.Empty();
|
||||||
if (!RemovedPairs.Contains(KeyPair.Key))
|
ItRemove.RemoveCurrent();
|
||||||
{
|
|
||||||
RemovedPairs.Add(KeyPair.Key, KeyPair.Value);
|
|
||||||
bMadeChanges = true;
|
bMadeChanges = true;
|
||||||
}
|
|
||||||
|
|
||||||
continue; // skip remaining checks as we have invalid primitives anyway
|
continue; // skip remaining checks as we have invalid primitives anyway
|
||||||
}
|
}
|
||||||
|
@ -267,16 +264,6 @@ void UCollisionIgnoreSubsystem::CheckActiveFilters()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
#endif
|
#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
|
/*#if WITH_CHAOS
|
||||||
|
@ -295,13 +282,18 @@ void UCollisionIgnoreSubsystem::CheckActiveFilters()
|
||||||
}
|
}
|
||||||
#endif*/
|
#endif*/
|
||||||
|
|
||||||
for (const TPair<FCollisionPrimPair, FCollisionIgnorePairArray>& KeyPair : RemovedPairs)
|
/*for (const TPair<FCollisionPrimPair, FCollisionIgnorePairArray>& KeyPair : RemovedPairs)
|
||||||
{
|
{
|
||||||
if (CollisionTrackedPairs.Contains(KeyPair.Key))
|
if (CollisionTrackedPairs.Contains(KeyPair.Key))
|
||||||
{
|
{
|
||||||
CollisionTrackedPairs[KeyPair.Key].PairArray.Empty();
|
CollisionTrackedPairs[KeyPair.Key].PairArray.Empty();
|
||||||
CollisionTrackedPairs.Remove(KeyPair.Key);
|
CollisionTrackedPairs.Remove(KeyPair.Key);
|
||||||
}
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
if (bMadeChanges)
|
||||||
|
{
|
||||||
|
CollisionTrackedPairs.Compact();
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateTimer(bMadeChanges);
|
UpdateTimer(bMadeChanges);
|
||||||
|
|
|
@ -468,7 +468,7 @@ void UVRRootComponent::UpdateCharacterCapsuleOffset()
|
||||||
{
|
{
|
||||||
if (owningVRChar && !owningVRChar->bRetainRoomscale && owningVRChar->NetSmoother)
|
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);
|
owningVRChar->NetSmoother->SetRelativeLocation(GetTargetHeightOffset(), false, nullptr, ETeleportType::TeleportPhysics);
|
||||||
|
|
||||||
|
@ -594,9 +594,23 @@ void UVRRootComponent::TickComponent(float DeltaTime, enum ELevelTick TickType,
|
||||||
Params.bFindInitialOverlaps = true;
|
Params.bFindInitialOverlaps = true;
|
||||||
bool bBlockingHit = false;
|
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;
|
bool bAllowWalkingCollision = false;
|
||||||
if (CharMove != nullptr)
|
if (CharMove != nullptr)
|
||||||
{
|
{
|
||||||
|
|
|
@ -137,8 +137,7 @@ public:
|
||||||
FQuat GetCalculatedRotation(FRotator InverseRot, float DeltaTime)
|
FQuat GetCalculatedRotation(FRotator InverseRot, float DeltaTime)
|
||||||
{
|
{
|
||||||
FRotator FinalRot = FRotator::ZeroRotator;
|
FRotator FinalRot = FRotator::ZeroRotator;
|
||||||
|
if (FPlatformMath::Abs(FMath::FindDeltaAngleDegrees(InverseRot.Yaw, LastRot)) < YawTolerance) // This is never true with the default value of 0.0f
|
||||||
if (FPlatformMath::Abs(FRotator::ClampAxis(InverseRot.Yaw) - LastRot) < YawTolerance) // This is never true with the default value of 0.0f
|
|
||||||
{
|
{
|
||||||
if (!bWasSetOnce)
|
if (!bWasSetOnce)
|
||||||
{
|
{
|
||||||
|
|
|
@ -57,8 +57,15 @@ public:
|
||||||
inline FVector GetTargetHeightOffset()
|
inline FVector GetTargetHeightOffset()
|
||||||
{
|
{
|
||||||
//return FVector::ZeroVector;
|
//return FVector::ZeroVector;
|
||||||
|
if (bCenterCapsuleOnHMD)
|
||||||
|
{
|
||||||
|
return FVector(0.f, 0.f, (-VRCapsuleOffset.Z) - curCameraLoc.Z);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
return FVector(0.f, 0.f, (-this->GetUnscaledCapsuleHalfHeight()) - VRCapsuleOffset.Z);
|
return FVector(0.f, 0.f, (-this->GetUnscaledCapsuleHalfHeight()) - VRCapsuleOffset.Z);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is overidden for the VR Character to re-set physics location
|
* This is overidden for the VR Character to re-set physics location
|
||||||
|
@ -266,7 +273,7 @@ void inline UVRRootComponent::GenerateOffsetToWorld(bool bUpdateBounds, bool bGe
|
||||||
|
|
||||||
if(owningVRChar && !owningVRChar->bRetainRoomscale)
|
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
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue