How to move a player in a circular motion? using setplayervelocity maybe?
#1

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?
Reply
#2

bump

*crap sorry.. that was 8 hours
Reply
#3

Maybe if you used a lot of SetPlayerPos
Reply
#4

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:
  • Get the radius of the circle and the position the player is at
  • Have a low millisecond timer (200 for example) and select a different angle from the radius
  • Use cosine and sin functions to calculate the X and Y from the position to circle based on angle
  • Use SetPlayerVelocity to move the player towards that point (in correspondence to the update of the timer)
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.
Reply
#5

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)