DestinationMark rotates itself


DestinationMark rotates itself while I move my motion controller

my code:

bool AVR_Character::FindTeleportDestination(TArray& OutPath, FVector& OutLocation)
{
FVector Look = RightMotionController->GetForwardVector();

FVector Location = RightMotionController->GetComponentLocation() + Look * 15.0f;


FPredictProjectilePathParams Params(TeleportProjectileRadius, Location, Look * TeleportProjectileSpeed, TeleportSimulationTime, ECollisionChannel::ECC_MAX, this);
Params.DrawDebugType = EDrawDebugTrace::ForOneFrame;
Params.bTraceComplex = true;

FPredictProjectilePathResult Result;

bool bSucess = UGameplayStatics::PredictProjectilePath(this, Params, Result);

if (!bSucess) return false;

												
for (FPredictProjectilePathPointData PointData : Result.PathData)
{
	
	OutPath.Add(PointData.Location);
};

FNavLocation Navigation;

bool bNavigative = UNavigationSystemV1::GetCurrent(GetWorld())->ProjectPointToNavigation(Result.HitResult.Location, Navigation, TeleportationExtent);
if (!bNavigative)return false;

OutLocation = Navigation.Location;

return true;

}
void AVR_Character::LocationTeleportDistance()
{

TArray<FVector> Path;

FVector Location;
bool bHasDestination = FindTeleportDestination(Path, Location);
if (bHasDestination)
{

	DestinationMark->SetVisibility(true);
	
	DestinationMark->SetWorldLocation(Location);

}
else
{
	DestinationMark->SetVisibility(false);

	
}

}

It would rotate if you make it a child of the motion controller. It will inherit this. You need to have the destination mark and controller hve the same parent in the Blueprint so the actual transforms are separate from one another.

thank you sir

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms