Change x and y velocity based on player facing angle? - 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)
+--- Thread: Change x and y velocity based on player facing angle? (
/showthread.php?tid=532307)
Change x and y velocity based on player facing angle? -
Aerotactics - 17.08.2014
I don't know what to do here, I have 2 portals. When a player enters the first portal, their velocity is saved and given to them on the exit portal, but the exit portal changes facing angle, while the velocity continues from the entrance portal. Is there a way to get the facing angle of the exit portal, then set their x and y velocity to exit straight from the exit portal? My assumption is that it's a math problem, but IDK where to start.
Re: Change x and y velocity based on player facing angle? -
Pottus - 17.08.2014
I'm not sure but I know Nero3D would know what to do but I'm pretty sure atan2() is involved somewhere here.
Re: Change x and y velocity based on player facing angle? -
Virtual1ty - 17.08.2014
You're trying to recreate the game "Portal" right? Unfortunately I never played it or heard about it so I dunno what you mean by "changing player facing angle on exit portal" but if those portals are like you "drop from a ceiling onto a platform", then the only way I guess would be getting that platforms landing XYZ and determine the angle difference (actually coordinates to get the angle) from the portals XYZ from where you start to "drop" and the platforms XYZ where you land. I don't believe there's any other way AFAIK.
Re: Change x and y velocity based on player facing angle? -
Aerotactics - 17.08.2014
Quote:
Originally Posted by Virtual1ty
You're trying to recreate the game "Portal" right? Unfortunately I never played it or heard about it so I dunno what you mean by "changing player facing angle on exit portal" but if those portals are like you "drop from a ceiling onto a platform", then the only way I guess would be getting that platforms landing XYZ and determine the angle difference (actually coordinates to get the angle) from the portals XYZ from where you start to "drop" and the platforms XYZ where you land. I don't believe there's any other way AFAIK.
|
Yes, I am attempting to recreate the game in SAMP. I have only seen it done once before, and it wasn't based off the game as I recall. I already know my attempt is in vain, but I want to see how far I can get.
Re: Change x and y velocity based on player facing angle? -
Pottus - 17.08.2014
Nero is on now, can you look at this Nero_3D ?
AW: Change x and y velocity based on player facing angle? -
Nero_3D - 18.08.2014
The truth is I can't help here, I have no experience with rotations of objects
I think if you want to solve that problem you should get the difference of the rotations from both objects and rotate the incoming vector from the first portal with rotation matrixes to match the exit portal
Re: Change x and y velocity based on player facing angle? -
Aerotactics - 18.08.2014
That sounds about right. I'll get to it.