5#include "Kismet/GameplayStatics.h"
6#include "Kismet/KismetMathLibrary.h"
11 : PixoVRCharacter(nullptr)
12 , RotationOffset(0.0f, 0.0f, 0.0f)
16 , AlignmentSpeed(8.0f)
18 PrimaryComponentTick.bCanEverTick =
true;
28 Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
35 if(
APlayerController* PlayerController = UGameplayStatics::GetPlayerController(GetWorld(), 0))
37 Character = Cast<APixoVRCharacter>(PlayerController->GetPawn());
43 FRotator Rotator = UKismetMathLibrary::FindLookAtRotation(GetComponentLocation(), Character->
VRReplicatedCamera->GetComponentLocation());
62 Rotator = UKismetMathLibrary::RInterpTo(GetComponentRotation(),
68 SetWorldRotation(Rotator);
73void UPlayerAlignComponent::PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent)
75 if(PropertyChangedEvent.Property !=
nullptr)
77 const FName PropertyName (PropertyChangedEvent.Property->GetFName());
84 Super::PostEditChangeProperty(PropertyChangedEvent);
88void UPlayerAlignComponent::GetLifetimeReplicatedProps(TArray< FLifetimeProperty > & OutLifetimeProps)
const
90 Super::GetLifetimeReplicatedProps(OutLifetimeProps);
Pixo VR Character This class represents the main character in the Pixo VR game. It extends the AVRCha...
UReplicatedVRCameraComponent * VRReplicatedCamera
UPROPERTY(Category = VRBaseCharacter, VisibleAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess ...
Component that aligns an object to player.
FRotator RotationOffset
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "PixoVR | Align")
virtual void BeginPlay() override
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override
bool bLockPitch
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "PixoVR | Align")
bool bLockYaw
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "PixoVR | Align")
float AlignmentSpeed
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "PixoVR | Align")
APixoVRCharacter * PixoVRCharacter
UPROPERTY(BlueprintReadWrite, Replicated, Category = "PixovR | Align")
bool bLockRoll
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "PixoVR | Align")