# Top-down 2D push angle velocity

I'm trying to determine the angle NPCs are pushed in when the PLAYER collides with them, like how 'Retro City Rampage' and 'Shakedown Hawaii' do when you bump in pedestrians.

Here the PLAYER (green) is coming in at an angle of -45, what's the math or formula I need to be looking at to decide the new angle each NPC (red) should adopt?

• Have you tried something simple, like having the NPC move away along the line from the player's position through the NPC's position? – DMGregory Aug 10 '19 at 10:10

2.) NPCs run perpendicular to the player's direction. To achieve this, you need to take the direction of the player and rotate it 90 degrees. Since there are two solutions to this (rotate it clockwise or counterclockwise) you need to decide which one to use (it can be random). For any vector $$\\vec v(x,y)\$$ the two vectors, that are perpendicular to it are $$\\vec v'(-y, x)\$$ and $$\\vec v''(y, -x)\$$