# Vector vs Scalar velocity?

I am revamping an engine I have been working on and off on for the last few weeks to use a directional vector to dictate direction; this way I can dictate the displacement based on a direction. However, the issue I am trying to overcome is the following problem; the speed towards X and speed towards Y are unrelated to one another. If gravity pulls the object down by an increasing velocity my velocity towards the X should not change. This is very easy to implement if my speed is broken into a Vector datatype, Vector.X dictates one direction Vector.Y dictates the other (assuming we are not concerned about the Z axis). However, this defeats the purpose of the directional vector because:

  SpeedX = 10
SpeedY = 15

[1, 1] normalized = ~[0.7, 0.7]

[0.7, 0.7] * [10, 15] = [7, 10.5]


As you can see my direction is now "scaled" to my speed which is no longer the direction that I want to be moving in.

I am very new to vector math and this is a learning project for me. I looked around a little bit on the internet but I still want to figure out things on my own (not just look at an example and copy off it). Is there way around this? Using a directional vector is extremely useful but I am a little bit stumped at this problem. I am sorry if my mathematical understanding maybe completely wrong.

• If you are moving at X=10, Y=15 then you are moving in the direction [10,15] = [2,3], not [1,1]. I'm not sure what you mean by this not being the direction you want to move in. – Donnie Dec 9 '12 at 8:52
• A direction vector tells the object which way its moving (and commonly which way its facing). Say for instance [0.7, 0.7] * MySpeed will yield a displacement vector so I can say MyPosition + MyDisplacementVector. – Serguei Fedorov Dec 9 '12 at 8:58

Once you're storing your velocity as a scaled vector, you can adjust the vertical component separately from the horizontal component. For example, to apply gravity, you will normally just add gravity * time (or -gravity, depending on which direction your y axis goes and whether you express gravity as a positive or negative number).