Getting random cordinates within a checkpoint
#5

Quote:
Originally Posted by Vince
Посмотреть сообщение
PHP код:
new const checkPointRadius 15;
new 
    
Float:randomAngle float(random(360)),
    
Float:randomDistance random(checkPointRadius); 
new
    
Float:dropX checkPointX floatsin(-randomAngledegrees) * randomDistance,
    
Float:dropY checkPointY floatcos(-randomAngledegrees) * randomDistance,
    
Float:dropZ checkPointZ 0.5
Something like that should work. This picks a random angle between 0 and 360 (a full circle, as you know) and a random distance between 0 and the size of the radius of the checkpoint. Then some trig is done to calculate the coordinates at the specified angle and the specified distance. Can't really explain that. Rather mathematically complex.
Thank you very much man. This helped a lot!
Reply


Messages In This Thread
Getting random cordinates within a checkpoint - by HBG - 02.09.2015, 00:44
Re: Getting random cordinates within a checkpoint - by SickAttack - 02.09.2015, 00:57
Re: Getting random cordinates within a checkpoint - by HBG - 02.09.2015, 01:24
Re: Getting random cordinates within a checkpoint - by Vince - 02.09.2015, 09:42
Re: Getting random cordinates within a checkpoint - by HBG - 02.09.2015, 10:16

Forum Jump:


Users browsing this thread: 4 Guest(s)