-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathSilent.cpp
39 lines (34 loc) · 1.25 KB
/
Silent.cpp
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
FVector OriginalLocation(0,0,0);
FRotator OriginalRotation(0,0,0);
// https://docs.unrealengine.com/4.27/en-US/API/Runtime/Engine/Engine/ULocalPlayer/GetViewPoint/
void(*GetViewPoint)(ULocalPlayer*, FMinimalViewInfo*, EStereoscopicPass) = nullptr;
void GetViewPointHook(ULocalPlayer* this_LocalPlayer, FMinimalViewInfo* OutViewInfo, EStereoscopicPass StereoPass)
{
GetViewPoint(this_LocalPlayer, OutViewInfo, StereoPass);
if (PlayerController->IsInputKeyDown(Key))
{
OutViewInfo->Location = OriginalLocation;
OutViewInfo->Rotation = OriginalRotation;
}
}
// https://docs.unrealengine.com/4.26/en-US/API/Runtime/Engine/GameFramework/APlayerController/GetPlayerViewPoint/
void(*GetPlayerViewPoint)(APlayerController*, FVector*, FRotator*) = nullptr;
void GetPlayerViewPointHook(APlayerController* this_PlayerController, FVector* Location, FRotator* Rotation)
{
GetPlayerViewPoint(this_PlayerController, Location, Rotation);
OriginalLocation = *Location;
OriginalRotation = *Rotation;
if (BestTarget)
{
if (PlayerController->IsInputKeyDown(Key))
{
USkeletalMeshComponent* Mesh = BestTarget->Mesh;
if (Mesh)
{
// Get Target Bone Location
FRotator TargetRotation; // = Calculate Rotation
*Rotation = TargetRotation; // Set Rotation
}
}
}
}