SA-MP Forums Archive
How to move a player in a circular motion? using setplayervelocity maybe? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to move a player in a circular motion? using setplayervelocity maybe? (/showthread.php?tid=258322)



How to move a player in a circular motion? using setplayervelocity maybe? - Donya - 30.05.2011

ok well, i want to move a player in a circle, yes the player will be in the air, so setplayervelocity would work just fine

http://upload.wikimedia.org/wikipedi...RCLE_1.svg.png

http://upload.wikimedia.org/wikipedi..._LINES.svg.png

i already know how to do it with setplayerpos, but theres no moveplayerpos related to moveobjectpos, so any ideas for this?


Re: How to move a player in a circular motion? using setplayervelocity maybe? - Donya - 30.05.2011

bump

*crap sorry.. that was 8 hours


Re: How to move a player in a circular motion? using setplayervelocity maybe? - Osviux - 30.05.2011

Maybe if you used a lot of SetPlayerPos


Re: How to move a player in a circular motion? using setplayervelocity maybe? - Bakr - 30.05.2011

This is interesting topic, as I was trying to do something similar to this before.

Unfortunately, there is no way to actually do this (perfectly at least). As with SetPlayerVelocity there isn't a rotation parameter, so only allowing the velocity to push the player in a straight direction (unless there is another way that I'm not aware of, but I'm sure that would take a lot of calculations anyway). The way I made a decent look alike of this was:The function I used to get the new XY coordinates was GetXYInFrontOfPoint, a edit of GetXYInFrontOfPlayer, by ******:
pawn Код:
GetXYInFrontOfPoint( &Float: x, &Float: y, Float: angle, Float: distance ) {

   x += ( distance * floatsin( -angle, degrees ) );
   y += ( distance * floatcos( -angle, degrees ) );
}
Note it also took me FOREVER to make it look anywhere decent trying to balance the velocity to move the player by and how frequently the timer would update the velocity.


Re: How to move a player in a circular motion? using setplayervelocity maybe? - Donya - 30.05.2011

Quote:
Originally Posted by Donya
Посмотреть сообщение
i already know how to do it with setplayerpos, but theres no moveplayerpos related to moveobjectpos, so any ideas for this?
@Osviux, seriously read everything before you reply.

@Bakr, hmm ok

1. i have the radius

2. got that

3. this i might need help on, well ok i made something called "CircleObject" that circles any object in any radius, speed, and the degree you want to add everytime it moves the object, now im trying to move the player kinda like that, but NOT using setplayerpos which looks bad

4. will try that.

thanks for your help! really, you gave me some ideas. hope to see much more responds especially from Mauzen maybe