I’m pretty new to UE and I’ve been trying to create a source engine surf type character controller based on a pawn controller I found and got it pretty much working, however when I reopened the project today I started having some weird issues - I just slide down slopes like a real object would rather than “surfing” along it. The rest of the behavior seems to be working.
I went to investigate what was happening and although my movement calculations are working correctly, it seems the velocity gets randomly changed when it’s accessed. Initially I was using the inherited “Velocity” member variable, so I tried to start storing the value in other places in case the movement component class was doing something with it without me telling it to. However even after switching to a new variable “_Velocity” for calculations and a separate variable “VC” to cache velocity between frames for even more safety I’m still getting the issue. A local variable “V0” manages to keep its value. Here are the header and implementation files for the movement component:
And the logs showing _Velocity switching between “_Velocity Final” statement and the start of the next frame: