Search the Community
Showing results for tags 'vector'.
Found 1 result
Since the various advice threads in this forum seem to be divided up by engine (Unity, Gamemaker, Unreal etc.), I thought it might be useful to have a more general thread for asking and answering questions about the discipline that we all seem to either love or hate. I'll kick things off with a question of my own. If I have a vector representing the direction that I'm facing and another vector representing the velocity of an object somewhere in the world, how can I use that information to find out how fast that object is moving perpendicular to me? To put it another way, I want to single out the speed at which the object is moving in a direction of my choosing, ignoring velocity in all unrelated directions. Because this seemed to cause some confusion when I asked about it on IRC, I've come up with an example: Let's say that on a 2D grid, I am looking straight down the y axis. There is an object somewhere that is moving at a velocity (v) of (x=1, y=1). How can I find out how fast the object is moving along the x axis (p)? In the example we can easily figure out that p is 1 by taking the x component of the object's velocity, but that is only possible because we're aligned with the grid. How can I find out what p is if I'm facing an arbitrary direction?