Random coordinates around a positions
#6

Quote:
Originally Posted by Freaksken
Посмотреть сообщение
No, that's incorrect, follow some math courses ...

This is correct:
Код:
//A function to get a point on the edge of a circle, given a radius and an angle
GetPointOnEdgeOfCircle(&Float:x, &Float:y, Float:r, Float:a, bool:isGTAAngle = false) {
	if(isGTAAngle) { //In case the angle was retrieved with GetPlayerFacingAngle, GetVehicleZAngle, ...
		a += 90.0;
	}
	x += r * floatcos(a, degrees);
	y += r * floatsin(a, degrees);
}

//Get the player's position
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);

//Example with radius = 50.0
GetPointOnEdgeOfCircle(x, y, 50.0, frandom(360.0)); //See this post for frandom
Thanks, but it not works as i wanted.
I'm making a 'dumpster diving' system (you can pick up up trashes from the dumpsters and drop it around the player). That i made is almost working as i want, but there is a bug whenever the object hit the player which cause collapse damage (about 3-25 points) for the player.
How i should make this system to place the object around the player like this?
Reply


Messages In This Thread
Random coordinates around a positions - by m4karow - 11.08.2018, 19:50
Re: Random coordinates around a positions - by ItsRobinson - 11.08.2018, 20:29
Re: Random coordinates around a positions - by Freaksken - 11.08.2018, 22:00
Re: Random coordinates around a positions - by ItsRobinson - 11.08.2018, 22:01
Re: Random coordinates around a positions - by Freaksken - 11.08.2018, 22:07
Re: Random coordinates around a positions - by m4karow - 12.08.2018, 08:36
Re: Random coordinates around a positions - by m4karow - 18.08.2018, 13:27
Re: Random coordinates around a positions - by Shinja - 18.08.2018, 15:17
Re: Random coordinates around a positions - by m4karow - 18.08.2018, 15:23
Re: Random coordinates around a positions - by Freaksken - 18.08.2018, 15:43

Forum Jump:


Users browsing this thread: 5 Guest(s)