SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Discussion

Reply
 
Thread Tools Display Modes
Old 16/01/2018, 10:31 AM   #1
5740
Little Clucker
 
Join Date: Feb 2017
Posts: 6
Reputation: 0
Default Setting player's velocity to move player to specific position?

Ok. I know how to SET a player's back position using trigonometric function.

Code:
GetPlayerPos(playerid, oldpos[0], oldpos[1], oldpos[2]);
GetPlayerFacingAngle(playerid, angle);

newpos[0] = oldpos[0] + (Radius * floatcos(angle - 90, degrees));
newpos[1] = oldpos[1] + (Radius * floatsin(angle - 90, degrees));
newpos[2] = oldpos[2];

//newpos is the player's front pos
But you can see, this code is for SETTING player's position, NOT MOVING player's position.
So I noticed only way to move player is setting player's velocity, not setting position.

Now here is the question: Is there any way to set player velocity to move player to specific position?
I tried to do this by myself, but I had know idea to move player to specific position using velocity..
5740 is offline   Reply With Quote
Old 16/01/2018, 01:06 PM   #2
Meller
Gangsta
 
Meller's Avatar
 
Join Date: Dec 2016
Posts: 638
Reputation: 132
Default Re: Setting player's velocity to move player to specific position?

It really depends on the geographic location, is there objects blocking-- is the character in need of move up in order to pass? does the character need to go west or east, north or south? is there a clear way to move(straight line?) etc
Meller is offline   Reply With Quote
Old 31/01/2018, 11:50 AM   #3
5740
Little Clucker
 
Join Date: Feb 2017
Posts: 6
Reputation: 0
Default Re: Setting player's velocity to move player to specific position?

Quote:
Originally Posted by Meller View Post
It really depends on the geographic location, is there objects blocking-- is the character in need of move up in order to pass? does the character need to go west or east, north or south? is there a clear way to move(straight line?) etc
Well..but that's why I'm trying to move player using velocity. Using velocity to move player won't move player to wrong position, just making speed(velocity) to move.

So, is there really no way about this?
5740 is offline   Reply With Quote
Old 15/02/2018, 12:06 PM   #4
Slice
High-roller
 
Join Date: Mar 2008
Location: Sweden
Posts: 1,900
Reputation: 1586
Default Re: Setting player's velocity to move player to specific position?

It's possible, but you won't be able to use standard formulas because there is a limitation on the Z velocity. How far do you want to move the player?
Slice is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert Player Velocity NeXoR Scripting Help 3 14/04/2016 09:10 AM
Set Player Velocity YouServ Scripting Help 1 27/01/2016 03:59 PM
Change x and y velocity based on player facing angle? Aerotactics Scripting Help 6 18/08/2014 06:29 PM
How to change player sprint with velocity ? D0os Scripting Help 2 16/06/2012 05:07 PM
Player Velocity etc. sekol Help Archive 4 21/10/2010 09:15 PM


All times are GMT. The time now is 08:46 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.