A Demo Project for the UnrealEngineSDK
Loading...
Searching...
No Matches
OptionalRepSkeletalMeshActor.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
5#include "CoreMinimal.h"
7#include "Engine/Engine.h"
8#include "Animation/SkeletalMeshActor.h"
9#include "Components/SkeletalMeshComponent.h"
10#include "Components/SphereComponent.h"
11#include "Engine/ActorChannel.h"
12#include "OptionalRepSkeletalMeshActor.generated.h"
13
14// Temp comp to avoid some engine issues, exists only until a bug fix happens
15UCLASS(Blueprintable, meta = (BlueprintSpawnableComponent, ChildCanTick), ClassGroup = (VRExpansionPlugin))
16class VREXPANSIONPLUGIN_API UNoRepSphereComponent : public USphereComponent
17{
18 GENERATED_BODY()
20public:
21 UNoRepSphereComponent(const FObjectInitializer& ObjectInitializer);
22
23 UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "Component Replication")
24 bool bReplicateMovement;
25
26 virtual void PreReplication(IRepChangedPropertyTracker& ChangedPropertyTracker) override;
27};
28
34USTRUCT()
36{
37 GENERATED_USTRUCT_BODY()
38
40
41 virtual void ExecuteTick(float DeltaTime, enum ELevelTick TickType, ENamedThreads::Type CurrentThread, const FGraphEventRef& MyCompletionGraphEvent) override;
42
43 virtual FString DiagnosticMessage() override;
44
45 virtual FName DiagnosticContext(bool bDetailed) override;
46
47};
48template<>
49struct TStructOpsTypeTraits<FSkeletalMeshComponentEndPhysicsTickFunctionVR> : public TStructOpsTypeTraitsBase2<FSkeletalMeshComponentEndPhysicsTickFunctionVR>
50{
51 enum
52 {
53 WithCopy = false
54 };
55};
56
57// A base skeletal mesh component that has been added to temp correct an engine bug with inversed scale and physics
58UCLASS(Blueprintable, meta = (ChildCanTick, BlueprintSpawnableComponent), ClassGroup = (VRExpansionPlugin))
60{
61 GENERATED_BODY()
62
63public:
64 UInversePhysicsSkeletalMeshComponent(const FObjectInitializer& ObjectInitializer);
65
66public:
67
68 // Overrides the default of : true and allows for controlling it like in an actor, should be default of off normally with grippable components
69 UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "Component Replication")
70 bool bReplicateMovement;
71
72 // This is all overrides to fix the skeletal mesh inverse simulation bug
73 // WILL BE REMOVED LATER when the engine is fixed
76 void EndPhysicsTickComponentVR(FSkeletalMeshComponentEndPhysicsTickFunctionVR& ThisTickFunction);
77 void BlendInPhysicsInternalVR(FTickFunction& ThisTickFunction);
78 void FinalizeAnimationUpdateVR();
79
80 virtual FBoxSphereBounds CalcBounds(const FTransform& LocalToWorld) const override
81 {
82 // Get rid of inverse issues
83 FTransform newLocalToWorld = LocalToWorld;
84 newLocalToWorld.SetScale3D(newLocalToWorld.GetScale3D().GetAbs());
85
86 return Super::CalcBounds(newLocalToWorld);
87 }
89 UFUNCTION(BlueprintPure, Category = "VRExpansionFunctions")
90 FBoxSphereBounds GetLocalBounds() const
91 {
92 return this->GetCachedLocalBounds();
93 }
94
95 void PerformBlendPhysicsBonesVR(const TArray<FBoneIndexType>& InRequiredBones, TArray<FTransform>& InBoneSpaceTransforms);
96 virtual void RegisterEndPhysicsTick(bool bRegister) override;
97 virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
98 // END INVERSED MESH FIX
99
100 virtual void PreReplication(IRepChangedPropertyTracker & ChangedPropertyTracker) override;
101
102};
103
109UCLASS(Blueprintable, meta = (BlueprintSpawnableComponent, ChildCanTick), ClassGroup = (VRExpansionPlugin))
110class VREXPANSIONPLUGIN_API AOptionalRepGrippableSkeletalMeshActor : public ASkeletalMeshActor
112 GENERATED_BODY()
113
114public:
115 AOptionalRepGrippableSkeletalMeshActor(const FObjectInitializer& ObjectInitializer);
116
117 // Skips the attachment replication
118 UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "Replication")
119 bool bIgnoreAttachmentReplication;
120
121 // Skips the physics replication
122 UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "Replication")
123 bool bIgnorePhysicsReplication;
124
125 // Fix bugs with replication and bReplicateMovement
126 virtual void OnRep_ReplicateMovement() override;
127 virtual void PostNetReceivePhysicState() override;
128};
UCLASS(Blueprintable, meta = (BlueprintSpawnableComponent, ChildCanTick), ClassGroup = (VRExpansionPl...
bool bIgnoreAttachmentReplication
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "Replication")
bool bIgnorePhysicsReplication
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "Replication")
UCLASS(Blueprintable, meta = (ChildCanTick, BlueprintSpawnableComponent), ClassGroup = (VRExpansionPl...
FBoxSphereBounds GetLocalBounds() const
UFUNCTION(BlueprintPure, Category = "VRExpansionFunctions")
virtual FBoxSphereBounds CalcBounds(const FTransform &LocalToWorld) const override
FSkeletalMeshComponentEndPhysicsTickFunctionVR EndPhysicsTickFunctionVR
bool bReplicateMovement
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "Component Replication")
UCLASS(Blueprintable, meta = (BlueprintSpawnableComponent, ChildCanTick), ClassGroup = (VRExpansionPl...
bool bReplicateMovement
UPROPERTY(EditAnywhere, Replicated, BlueprintReadWrite, Category = "Component Replication")
virtual void ExecuteTick(float DeltaTime, enum ELevelTick TickType, ENamedThreads::Type CurrentThread, const FGraphEventRef &MyCompletionGraphEvent) override
virtual FName DiagnosticContext(bool bDetailed) override