void USCarryObjectComponent::TickComponent(float DeltaSeconds, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) { if (APawn* OwningPawn = Cast<APawn>(GetOwner())) { if (OwningPawn->IsLocallyControlled()) { Super::TickComponent(DeltaSeconds, TickType, ThisTickFunction); } else { /* NOTE: Slightly changed code from base implementation (USpringArmComponent) to use RemoteViewPitch instead of non-replicated ControlRotation */ if (bUsePawnControlRotation) { { /* Re-map uint8 to 360 degrees */ const float PawnViewPitch = (OwningPawn->RemoteViewPitch / 255.f)*360.f; if (PawnViewPitch != GetComponentRotation().Pitch) { FRotator NewRotation = GetComponentRotation(); NewRotation.Pitch = PawnViewPitch; SetWorldRotation(NewRotation); } } } UpdateDesiredArmLocation(bDoCollisionTest, bEnableCameraLag, bEnableCameraRotationLag, DeltaSeconds); } } }
void USCarryObjectComponent::TickComponent(float DeltaSeconds, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) { //if (GetIsCarryingActor()) //{ // perform an overlap check of the actor vs. environment. must have 0 overlaps from Static and Dynamic and Pawn channels. // Use param NAME to update the color between red and green //} if (APawn* OwningPawn = Cast<APawn>(GetOwner())) { if (OwningPawn->IsLocallyControlled()) { Super::TickComponent(DeltaSeconds, TickType, ThisTickFunction); } else { /* NOTE: Slightly changed code from base implementation (USpringArmComponent) to use RemoteViewPitch instead of non-replicated ControlRotation */ if (bUsePawnControlRotation) { { /* Re-map uint8 to 360 degrees */ const float PawnViewPitch = (OwningPawn->RemoteViewPitch / 255.f)*360.f; if (PawnViewPitch != GetComponentRotation().Pitch) { FRotator NewRotation = GetComponentRotation(); NewRotation.Pitch = PawnViewPitch; SetWorldRotation(NewRotation); } } } UpdateDesiredArmLocation(bDoCollisionTest, bEnableCameraLag, bEnableCameraRotationLag, DeltaSeconds); } } }
void USpringArmComponent::OnRegister() { Super::OnRegister(); UpdateDesiredArmLocation(false, false, false, 0.f); // Init deprecated var, for old code that may refer to it. SetDeprecatedControllerViewRotation(*this, bUsePawnControlRotation); }
void USpringArmComponent::TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) { Super::TickComponent(DeltaTime, TickType, ThisTickFunction); if (bUsePawnControlRotation) { if (APawn* OwningPawn = Cast<APawn>(GetOwner())) { const FRotator PawnViewRotation = OwningPawn->GetViewRotation(); if (PawnViewRotation != GetComponentRotation()) { SetWorldRotation(PawnViewRotation); } } } UpdateDesiredArmLocation(bDoCollisionTest, bEnableCameraLag, bEnableCameraRotationLag, DeltaTime); }