My apologies if you think this question is supposed to be on the Math exchange, they scare me a bit and their answers usually don’t make any sense to me.
Right, I’m trying to get very basic physics in Javascript. I have a vector(direction and magnitude) and I need to modify both direction and magnitude because… well… gravity. I do know how to calculate it all using an x and y speed, but I wanted to go for a different approach this time and use vectors instead though I’m failing to understand it.
I’m sorry for giving so little information, but I’m clueless…
particle.velocity.angle += ?;
particle.velocity.speed += ?;
What’s the equation of modifying the angle and speed of a vector using an acceleration?
Rather than storing velocity as angle and speed, store it as x speed and y speed. Then gravity affects the y speed, but not the x speed. Gravity is a force, so it accelerates, meaning the change in speed is constant. At every time delta, change the y speed by the same amount, and you’ll get a gravity effect.