Calculating Walk Speed Based On Slope and Direction
So I'm working on movement for my first-person character and I want to slow the player down when travelling up slopes and speed them up when travelling down them.
So far I have discovered that you can get the floor normal from the player character movement component:
Which is great, however my problem is that I need to somehow take this normal and check it relative to my movement direction/velocity (not my facing direction, due to strafing etc.) so that I can determine if I'm going up or down a slope when i'm moving.
This is where my mathematical knowledge falls short unfortunately, so any help on this would be much appreciated!
asked Jan 04 '19 at 10:04 PM in Blueprint Scripting
I think the special sauce you're looking for is the vector dot product. For two normalized vectors, their dot product will be 1 if they point in the exact same direction, -1 if they point in exactly opposite directions, or 0 if they are at a right angle to one another.
This means that
Given that, I think you're looking for something along these lines:
Follow this question
Once you sign in you will be able to subscribe for any updates here