I’ll try to keep this short and sweet. First, I am having an issue comparing two vectors and getting the degree difference between them. I want to get the normal vector of the floor my character is standing on (I only care about checking this when the character is on a slope), and compare that to the right vector of my character. If my character is strafing into the slope, the degree value should read 0, and if the character is facing either directly towards or away from the slope, the value should read 90. However, currently, when on a slope, the value always reads 90 by default, and will read lower if strafing towards the slope, and higher if strafing away. I used a convert to vector2d to try and get rid of the influence of the slope, but for some reason it seems to not be working. Here is my blueprints of this part:
The other part that I am having trouble with is using this angle degree value to lerp between two different vectors. I currently have a vector pointing down the slope, as coming from “Calculate Floor Influence”, and I want to lerp from that to the forward vector of my character, based on the output angle of the section above. From testing, I would say it almost works perfectly, except that, depending on the angle my character is facing, sometimes the output vector (and the arrow I have to view its changes) flips around, sometimes going all the way to pointing in the opposite direction, and I don’t know why. That is my second part, and I was wondering if I should do something other than converting the vectors into rotators in order to lerp them nicely.
With a quick look at your code, I’d say your problem is you can’t lerp between moving values. Lerp takes two constants and moves between then, you’re trying to lerp between values that are changing while you’re doing the lerp.
If you want to do that sort of thing, the it’s time for ‘interp’.
Rinterp, in your case, take a ‘live’ current position and a fixed target position and moves between them. So you have to set the target before calling the node. It’s ok to do this on tick ( so the target is changing rapidly ), but the target has to be fixed.
Can you just say what you’re trying to do? As in ‘keep my character upright’, or ‘make my character face the slope directly’.