МЛ
if (bWasAttachmentModified ||
OldAttachParent != AttachmentReplication.AttachParent ||
OldAttachComponent != AttachmentReplication.AttachComponent)
{
MARK_PROPERTY_DIRTY_FROM_NAME(AActor, AttachmentReplication, this);
}
Size: a a a
МЛ
if (bWasAttachmentModified ||
OldAttachParent != AttachmentReplication.AttachParent ||
OldAttachComponent != AttachmentReplication.AttachComponent)
{
MARK_PROPERTY_DIRTY_FROM_NAME(AActor, AttachmentReplication, this);
}
С
С
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.
AttachmentReplication.AttachParent = RootComponent->GetAttachParent()->GetAttachmentRootActor();
if (AttachmentReplication.AttachParent != nullptr)
{
AttachmentReplication.LocationOffset = RootComponent->GetRelativeLocation();
AttachmentReplication.RotationOffset = RootComponent->GetRelativeRotation();
AttachmentReplication.RelativeScale3D = RootComponent->GetRelativeScale3D();
AttachmentReplication.AttachComponent = RootComponent->GetAttachParent();
AttachmentReplication.AttachSocket = RootComponent->GetAttachSocketName();
// Technically, the values might have stayed the same, but we'll just assume they've changed.
bWasAttachmentModified = true;
}
}
МЛ
С
С
С
МЛ
МЛ
С
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.
AttachmentReplication.AttachParent = RootComponent->GetAttachParent()->GetAttachmentRootActor();
if (AttachmentReplication.AttachParent != nullptr)
{
AttachmentReplication.LocationOffset = RootComponent->GetRelativeLocation();
AttachmentReplication.RotationOffset = RootComponent->GetRelativeRotation();
AttachmentReplication.RelativeScale3D = RootComponent->GetRelativeScale3D();
AttachmentReplication.AttachComponent = RootComponent->GetAttachParent();
AttachmentReplication.AttachSocket = RootComponent->GetAttachSocketName();
// Technically, the values might have stayed the same, but we'll just assume they've changed.
bWasAttachmentModified = true;
}
}
С
С
С
С
С
С
void AActor::OnRep_ReplicatedMovement()
{
// Since ReplicatedMovement and AttachmentReplication are REPNOTIFY_Always (and OnRep_AttachmentReplication may call OnRep_ReplicatedMovement directly),
// this check is needed since this can still be called on actors for which bReplicateMovement is false - for example, during fast-forward in replay playback.
// When this happens, the values in ReplicatedMovement aren't valid, and must be ignored.
if (!IsReplicatingMovement())
{
return;
}
С
С
МЛ
С