-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAsyncPhysicsInputComponent.h
More file actions
49 lines (34 loc) · 1.72 KB
/
Copy pathAsyncPhysicsInputComponent.h
File metadata and controls
49 lines (34 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Components/ActorComponent.h"
#include "Physics/AsyncPhysicsData.h"
#include "AsyncPhysicsInputComponent.generated.h"
UCLASS(BlueprintType, MinimalAPI)
class UAsyncPhysicsInputComponent : public UActorComponent
{
GENERATED_BODY()
public:
ENGINE_API UAsyncPhysicsInputComponent();
/** Sets the data class used. Can only call this once after the component has been created */
ENGINE_API void SetDataClass(TSubclassOf<UAsyncPhysicsData> InDataClass);
ENGINE_API virtual void AsyncPhysicsTickComponent(float DeltaTime, float SimTime) override;
UFUNCTION(Server, unreliable)
ENGINE_API void ServerRPCBufferInput(UAsyncPhysicsData* AsyncPhysicsData);
ENGINE_API void OnDispatchPhysicsTick(int32 PhysicsStep, int32 NumSteps, int32 ServerFrame);
ENGINE_API APlayerController* GetPlayerController();
/** Get the async physics data to write to. This data will make its way to the async physics tick on client and server. Should not be called from async tick */
UFUNCTION(BlueprintPure, Category = PlayerController)
ENGINE_API UAsyncPhysicsData* GetDataToWrite() const;
/** Get the async physics data to execute logic off of. This data should not be modified and will NOT make its way back. Should be called from async tick */
UFUNCTION(BlueprintPure, Category = PlayerController)
ENGINE_API const UAsyncPhysicsData* GetDataToConsume() const;
private:
UPROPERTY()
TSubclassOf<UAsyncPhysicsData> DataClass;
UPROPERTY(Transient)
TArray<TObjectPtr<UAsyncPhysicsData>> BufferedData;
UPROPERTY(Transient)
TObjectPtr<UAsyncPhysicsData> DataToConsume;
UPROPERTY(Transient)
TObjectPtr<UAsyncPhysicsData> DataToWrite;
};