the 2d flying can scroll all directions like a side scroller.
however it seems that the plane is moving faster when travelling straight on an axis,
if travelling diagonally i notice it is moving slower.
Lets say the Velocity is 3.
If you are traveling straight right (x axis) then the velocity on the x axis is 3 and y axis is 0 since you're not moving up or down, just to the side.
vice versa for the y axis, ie travelling straight up or down.
however if you travel, say, 45 degrees in between the primary axis lines.
i notice i'm going slower
and i did the math like this:
(If you are going diagonally, simplified) V (Velocity) = 3 (pixels per game loop) Xv (X velocity) = V / 2 Yv (Y velocity) = V / 2
(If you were going straight on an axis, Left/Right for example) Xv = V Yv = 0
But is this wrong?
Can I apply the pythagorean theroem to scale my velocity better? How to physics guys?
Your velocity magnitude should be equal but your velocity in the x direction will be decreased. Majora's mask has a glitch in it where if you go diagonally while goron rolling the magnitude of your velocity increases a bit. I don't have any proof of it but it seems to work when I'm goron racing, just wiggle back and forth and I go noticibley faster. Try and avoid that.
You must use Pythagorean theorem to compose velocities. If the particle is travelling in an angle a from the X axis, with absolute value V, then Vx = V cos a Vy = V sin a
Zachary Rodriguez
just google 'vector addition'
Bentley Turner
My fucking mind is blown
Joshua Parker
i dont know what the fuck a pythagorean theorem is but you don't need to divide diagonal by 2, you need to divide it by sqrt(1^2 + 1^2) i.e. sqrt(2)
Henry Walker
All u fags acting like this is simple, easy and basic information is pathetic. None of you guys realized this until I brought it up.
Benjamin Davis
>i like video games >i want to make video games >then the math came
And no it isn't a virus, I don't even know how to Pythagorean.
Nathaniel Smith
High school math is basic information you dipshit.
Carter Sanders
>diagonally >vx/2 >fucking divided by 2 You need to be 18 to post here School is back so do your homework and you might eventually start catching up.
Landon Young
Pythagorean theorem is a tool you need to use in oposite direction. Ie you know magnitude of x and y, add squares of both and take sqrt of the sum. The answer for your problem is hidden in a thin book with 'trigonometry' written on the cover
Jace Long
Wait what? If you want it to move the same speed when going diagonally your vx would still have to be 3. If you're scaling it then sure I guess you could soh cah toa for that.
Brandon Wilson
Just normalize and scale the vector that's going to be applied/added/whatever to your ships velocity from input? What the fuck is this thread.
>If you want it to move the same speed when going diagonally your vx would still have to be 3. Wrong. The magnitude of the vector must be 3, making vx = 3 * sin(45 degrees) ~= 2.12.
Brayden Sullivan
I should have elaborated and said if you want it to move the same velocity in the x-axis. Like most old retro games you feel like you're moving the same speed going diagonal or going straight ahead. In either case if you want similar horizontal scrolling experiences you want to maintain your Vx velocity. Keeping it the same feels more natural.
Jonathan Green
Read the OP: >the 2d flying can scroll all directions like a side scroller. It's obvious he wants actual diagonal scrolling.
Ayden Martin
>I never had trigonometry in middle school, so no one else had it either obviously
>All u fags acting like this is simple, easy and basic information is pathetic vector normalization is literally one of the most basic and common operations done in multi-axis programming. you're unironically fucked if you're actually this retarded and not pretending.
OP, don't let the mean anons make you feel bad, I remember making a thread almost exactly like this concerning basic ass polynomials when modding serverside sounds into minecraft in 2011 or some shit. Everyone starts somewhere.
>All u fags acting like this is simple, easy and basic information is pathetic But it is. Pythagoras alone doesn't save you, but with the theorem you could have realized that what you're doing is wrong. sqrt((V/2)^2 + (V/2)^2) = V/sqrt(2) What you need for 45° is V/sqrt(2) in x and y. However, you seem to have no understanding of sine and cosine laws, so I would recommend a math textbook before you advance any further.
Isaiah Jenkins
Should have been HS math (grade 10-11 or so).
x = R*cos(a); y = R*sin(a);
Your actual coordinates might be upsidedown in code since low-Y is up in many coordinate systems.
The angle is typically measured in radians not degrees, if you need to: float sin_degrees(float x) { float xx = x*PI/180.0; return sin(xx); }
Pythagorian Theorem: cos^2 + sin^2 = 1
To rotate 2-D cordinates:
* Convert to complex number [imaginary part is Y]
* multiple coordinate with coordinate from a unit circle
* [if the center of rotation isn't (0, 0) then multiply temporary coordinates that translated center to (0, 0) and rotate and translate back]