I figured this might do it, but its super buggy does anyone else have a better way of achieving it? Thanks! Here are some gyazos of what it does
The new code is around the bottom the Bis-aiming bool . Its a bit erratic and barely works really
Bigger Circle Pattern for Test
[video]https://gyazo.com/ab95dce98319f682cff3d4c001253e6d[/video]
Smaller Circle Pattern for Test
[video]https://gyazo.com/3280da482ecdac912c70b6e0bbc5ba9c[/video]
void AShatteredDreamsCharacter::Tick(float DeltaSeconds)
{
if (CursorToWorld != nullptr)
{
if (UHeadMountedDisplayFunctionLibrary::IsHeadMountedDisplayEnabled())
{
if (UWorld* World = GetWorld())
{
FHitResult HitResult;
FCollisionQueryParams Params;
FVector StartLocation = TopDownCameraComponent->GetComponentLocation();
FVector EndLocation = TopDownCameraComponent->GetComponentRotation().Vector() * 2000.0f;
Params.AddIgnoredActor(this);
World->LineTraceSingleByChannel(HitResult, StartLocation, EndLocation, ECC_Visibility, Params);
FQuat SurfaceRotation = HitResult.ImpactNormal.ToOrientationRotator().Quaternion();
CursorToWorld->SetWorldLocationAndRotation(HitResult.Location, SurfaceRotation);
}
}
else if (APlayerController* PC = Cast<APlayerController>(GetController()))
{
FHitResult TraceHitResult;
PC->GetHitResultUnderCursor(ECC_Visibility, true, TraceHitResult);
FVector CursorFV = TraceHitResult.ImpactNormal;
FRotator CursorR = CursorFV.Rotation();
CursorToWorld->SetWorldLocation(TraceHitResult.Location);
CursorToWorld->SetWorldRotation(CursorR);
if (BisAiming)
{
FVector Location = TraceHitResult.ImpactPoint;
Location + FVector(0, 0, 45);
FRotator Temp = Location.Rotation();
Temp.Pitch = 0;
Temp.Roll = 0;
ClientSetRotation(Temp);
SetActorRotation(Temp);
}
}
}
}