A Demo Project for the UnrealEngineSDK
Loading...
Searching...
No Matches
VRPlayerController.h
Go to the documentation of this file.
1// Fill out your copyright notice in the Description page of Project Settings.
2
3#pragma once
4#include "CoreMinimal.h"
5#include "VRBPDatatypes.h"
7#include "GameFramework/PlayerController.h"
8#include "Engine/LocalPlayer.h"
9#include "VRPlayerController.generated.h"
10
11
12// A base player controller specifically for handling OnCameraManagerCreated.
13// Used in case you don't want the VRPlayerCharacter changes in a PendingPlayerController
14UCLASS()
15class VREXPANSIONPLUGIN_API AVRBasePlayerController : public APlayerController
16{
17 GENERATED_BODY()
18
19public:
20
21 // Event called in BPs when the camera manager is created (only fired on locally controlled player controllers)
22 UFUNCTION(BlueprintImplementableEvent, meta = (DisplayName = "OnCameraManagerCreated"), Category = Actor)
23 void OnCameraManagerCreated(APlayerCameraManager* CameraManager);
24
25 virtual void SpawnPlayerCameraManager() override
26 {
27 Super::SpawnPlayerCameraManager();
29 if (PlayerCameraManager != NULL && IsLocalController())
30 {
31 OnCameraManagerCreated(PlayerCameraManager);
32 }
33 }
34
35};
36
37
38UCLASS()
39class VREXPANSIONPLUGIN_API AVRPlayerController : public AVRBasePlayerController
40{
41 GENERATED_BODY()
42
43public:
44 AVRPlayerController(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get());
45
46 // New path finding return, not actually sending anything currently unless the character created one for us
47 // or the user added one to us. The default implementation is fine for us.
48 //virtual IPathFollowingAgentInterface* GetPathFollowingAgent() const override;
49
50 // Disable the ServerUpdateCamera function defaulted on in PlayerCameraManager
51 // We are manually replicating the camera position and rotation ourselves anyway
52 // Generally that function will just be additional replication overhead
53 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "VRPlayerController")
54 bool bDisableServerUpdateCamera;
55
57 virtual void SpawnPlayerCameraManager() override;
58
59 FRotator LastRotationInput;
60
66 virtual void PlayerTick(float DeltaTime) override;
67};
68
69
73UCLASS(BlueprintType, Blueprintable, meta = (ShortTooltip = "Utility class, when set as the default local player it will spawn the target PlayerController class instead as the pending one"))
74class VREXPANSIONPLUGIN_API UVRLocalPlayer : public ULocalPlayer
75{
76 GENERATED_UCLASS_BODY()
77
78 UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "LocalPlayer")
79 TSubclassOf<class APlayerController> OverridePendingLevelPlayerControllerClass;
80
81 virtual bool SpawnPlayActor(const FString& URL, FString& OutError, UWorld* InWorld)
82 {
83 if (OverridePendingLevelPlayerControllerClass)
84 {
85 PendingLevelPlayerControllerClass = OverridePendingLevelPlayerControllerClass;
86 }
87
88 return Super::SpawnPlayActor(URL, OutError, InWorld);
89 }
90};
virtual void SpawnPlayerCameraManager() override
void OnCameraManagerCreated(APlayerCameraManager *CameraManager)
UFUNCTION(BlueprintImplementableEvent, meta = (DisplayName = "OnCameraManagerCreated"),...
bool bDisableServerUpdateCamera
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "VRPlayerController")
UCLASS(BlueprintType, Blueprintable, meta = (ShortTooltip = "Utility class, when set as the default l...
TSubclassOf< class APlayerController > OverridePendingLevelPlayerControllerClass
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "LocalPlayer")
virtual bool SpawnPlayActor(const FString &URL, FString &OutError, UWorld *InWorld)