Change x and y velocity based on player facing angle?
#1

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

I'm not sure but I know Nero3D would know what to do but I'm pretty sure atan2() is involved somewhere here.
Reply
#3

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.
Reply
#4

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.
Reply
#5

Nero is on now, can you look at this Nero_3D ?
Reply
#6

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

That sounds about right. I'll get to it.
Reply


Forum Jump:


Users browsing this thread: