mirror of
https://github.com/storytold/ActorSpawningPlugin.git
synced 2026-10-09 00:09:44 +00:00
random locations
This commit is contained in:
@@ -11,14 +11,22 @@ FVector ULocationLibrary::GetPlayerLocationWithOffset(UObject* worldContext,
|
|||||||
float x, float y, float z)
|
float x, float y, float z)
|
||||||
{
|
{
|
||||||
FVector playerLocation = GetPlayerLocation(worldContext);
|
FVector playerLocation = GetPlayerLocation(worldContext);
|
||||||
return playerLocation;
|
FVector newLocation(
|
||||||
|
playerLocation.X + x,
|
||||||
|
playerLocation.Y + y,
|
||||||
|
playerLocation.Z + z
|
||||||
|
);
|
||||||
|
return newLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
FVector ULocationLibrary::GetPlayerLocationWithRandomOffset(UObject* worldContext,
|
FVector ULocationLibrary::GetPlayerLocationWithRandomOffset(UObject* worldContext,
|
||||||
float minX, float maxX, float minY, float maxY, float minZ, float maxZ)
|
float minX, float maxX, float minY, float maxY, float minZ, float maxZ)
|
||||||
{
|
{
|
||||||
FVector playerLocation = GetPlayerLocation(worldContext);
|
float x = FMath::RandRange(minX, maxX);
|
||||||
return playerLocation;
|
float y = FMath::RandRange(minY, maxY);
|
||||||
|
float z = FMath::RandRange(minZ, maxZ);
|
||||||
|
|
||||||
|
return GetPlayerLocationWithOffset(worldContext, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
APawn* ULocationLibrary::GetPlayerPawn(UObject* worldContext)
|
APawn* ULocationLibrary::GetPlayerPawn(UObject* worldContext)
|
||||||
|
|||||||
Reference in New Issue
Block a user