How to create a Random Vector in C++ ?
e.g. create objects at random locations.
wiki:
FVector SpawnVector;
SpawnVector.X = FMath::FRandRange(0, 100);
SpawnVector.Y = FMath::FRandRange(0, 100);
SpawnVector.Z = FMath::FRandRange(0, 100);
1 Like
Also
// Random Vector with Length == 1
FRandomStream rand;
rand.GenerateNewSeed();
FVector randVector = rand.GetUnitVector();
1 Like
FMath::VRand();
2 Likes
when using this vector i get
error C2039: ‘RandomUnitVector’ : is not a member of ‘FVector’
Sorry. It’s FMath::VRand().