Z velocity not changing

okay, I’m trying to build a system that changes a characters acceleration based on wether or not they’re moving uphill or downhill. I did this by sensing the z velocity and then changing the acceleration value based on that, but no matter what I did, it only seemed to calculate his speed based on flat land. I tried everything I could think of, and I’m 100% sure my math is correct

so finally, i set it so that it would display my current z velocity on screen while playing, apparently my z velocity is only changing when I’m falling and not when I’m moving up or downhill… this may just be the way the engine works, but it doesn’t make much sense to me, is there a fix for this?

in the end I just need a way to tell if my character is walking up or downhill, I already have a way to calculate the angle and everything

Just subtract your current location, from the location you were one frame ago and normalize it. You now have a vector of which way your character is moving. Just make sure to set the PrevFrameLocation to the actors location on EventBeginPlay or you may get undesired results on the first frame of the game.

I tried it and the print out is telling me telling me that z is equal to zero… the weird thing is that now its not setting it to the flat land speed, its setting it to the uphill speed

Could I see your Blueprint? I put this on my character and it was giving me the vector correctly

yeah, here, update speed is based on an event tick btw

Can you post a screenshot of the printout? It is at least printing numbers right? Like 0.23,0.99,0.00?

yeah, when I move, but theyre all zero

What about when you are moving? They will be all zeroes if you are standing still. Also try printing out the GetActorLocation as well.

it only prints when
I’m moving, I had to stop to take a screenshot

What about just printing the GetActorLocation? It might not be get the location vector for some unknown reason.

wow, that ones working fine.

still isnt changing speed correctly though

If GetActorLocation is returning a vector and the subtraction between the 2 results in 0,0,0. Then the previous frame vector is the same as the current frame. I’m not sure how it’s being set that way. The previous location variable isn’t a local variable is it?

no its not, but I’m using the same variable to figure out the angle I’m standing on, so maybe thats causing problems? I wouldn’t think so, but I’ll try switching it out for a brand new variable

Didnt help, but heres something weird, whenever I jump while, the Y and X values go crazy when I land. you can see with the bottom value of this one

Well, my only solution at this point is to just put it in front of the branch. Like set it right after the tick. You would want it in front of the branch anyway. If you jumped it would mess up the vector when you land because it would stop setting the previous location and you would get a really big number like you did when you landed…

maybe… heres another weird thig, I switched the “get location” nodes out for “get velocity” and it got more or less the same results… except now it sets the speed to flat lands instead of uphill… thanks for your help anyways, ill post an answer if
I find a solution

Did you try it after the tick?

yeah, and I set it to location again. now the z value changes, but the speed doesnt, I’m gonna try setting it up so it has to go through your set up after every branch and see if that helps