I wanted a physics based player controlled character so instead of using the character class I have made a small character using the Pawn class.
The root of my character is a static mesh sphere without collision and a capsule as a child. My skeletal mesh component is linked to my capsule. I also have another static mesh component set to follow my mousecursor around and the capsule is always rotated towards this mesh. The capsule is moved around by setting the linear velocity depending on the inputaxis’.
So basically I have a little physics driven character running around always facing my mousecursor and its a pretty good setup.
However my current problem is that I dont know how to disable player input in the direction of a wall when they player jumps and hits a wall. Jump is also handled by adding linear velocity and the problem is that the character can cling to the walls mid-air if the player keeps holding the button down in that direction.
I already have a LineTraceByChannel pointing downwards in order to detect if my player is grounded and my initial idea was to add a linetrace in the direction he was jumping and disable velocity input when facing an obstruction. But how do I get this direction? And how do I fire the linetrace in this said direction?
Any help on the matter would be greatly appreciated
Bonus question; What would be an easy way to make the velocity affect jump height? So that when the player is moving faster he jumps higher - ?