Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Vector2 WaveGen::RandomiseSafePosition(Vector2 target_, float safetyDistance_)
- {
- //randomise a position
- int xPos = rand() % 100;
- int yPos = rand() % 100;
- Vector2 pos = Vector2(xPos,yPos);
- //check pos against the target_ pos
- float distance = (target_ - pos).GetMagnitude();
- if ( distance < safetyDistance_ )
- return RandomiseSafePosition(target_, safetyDistance_); //try again
- return pos;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement