My character, as a dynamic object, always gets stuck on walls if I jump while moving toward them. Even YoFrankie had the same issues.
I partially solved this by casting a ray in the direction of my player’s velocity. It sets my player’s linear velocity (x and y) to zero if a wall is detected. This solves one problem: now the player will smoothly slide down walls. For a complete solution, however, I need the player’s velocity to be projected along the surface of the wall, not just changed to zero. This crappy illustration demonstrates the desired result.
I’m a little rusty on the linear algebra, so I would just like a little help on how to get the green projected vector, given the player’s velocity (red) and the wall surface normal (yellow) obtained from KX_Game_Object.rayCast(). This is a 2-Dimensional operation because I let gravity worry about the player’s Z velocity.
I know about Vector.project(), I just don’t know the fastest way to get that green vector to project on in the first place, given the normal and my player’s velocity. Help?