Wot pythagorean theroem?

programing a 2d space flying game.

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?

pic related and shows diagram

Attached: intopythagorean.png (1140x490, 25K)

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.

bump for help pls
bump w/ god tier programming

Attached: bridges_made.png (1061x837, 255K)

Are you saying my Xv will be less then my Yv when in the middle of both the primary axis?

>Can I apply the pythagorean theroem to scale my velocity better?
Yes, obviously. Why are you even asking this is you already know the answer.

Attached: 720px-Unit_circle_angles.png (720x720, 81K)

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

just google 'vector addition'

My fucking mind is blown

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)

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.

>i like video games
>i want to make video games
>then the math came

Attached: 1477946872810.jpg (800x1000, 206K)

Depends on the direction you're going.

dropbox[.]com/s/6234dhze6kdvji9/Traveller.zip?dl=0

DL it then, windows only

And no it isn't a virus, I don't even know how to Pythagorean.

High school math is basic information you dipshit.

>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.

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

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.

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.

Attached: screenshot.png (861x659, 37K)

>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.

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.

Read the OP:
>the 2d flying can scroll all directions like a side scroller.
It's obvious he wants actual diagonal scrolling.

>I never had trigonometry in middle school, so no one else had it either obviously

Attached: 1568339055288.png (422x468, 52K)

>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.

Attached: 1567376721270.jpg (720x710, 26K)

I want to be a fly on the wall when OP tries to learn matrix rotations and occlusion culling for simple 3d spaces.

Imagine quaternions
>pic related, OP learning maths beyond elementary school

Attached: 1568220160205.jpg (881x1024, 76K)

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.

Attached: cat.jpg (300x250, 8K)

>quaternions
so it's like a torq

There's no shame in asking, but there is shame in being butthurt about people knowing more than you.

To be fair all the responses before the cringe are pretty shit and unhelpful. All he needed was "vector normalization"

Attached: 1a9.jpg (500x426, 21K)

Xv = cos(degrees) * V
Yv = sin(degrees) * V

Attached: ucad.gif (355x355, 5K)

I got defensive I'm sorry.

Holy shit. I felt like a fucking caveman trying to wrap my brain around this. I understand what I did now.

pic

I was scaling the change in velocity linearly and it just ain't that simple boss.

Attached: igetit.png (448x789, 14K)

>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.

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]