Hey all, I’m trying to make my character rotate when they are near a wall so that the feet face the wall, and the character’s front faces the current forward velocity. I’m not trying to change the gravity direction (actually I set the gravity to 0 when this happens) and I have some blueprint code that basically makes gravity return to normal when the character’s velocity drops below a certain threshold. So this rotation will only happen at high speed, then revert the character to falling when they drop below a certain speed. I currently have a sphere trace around the character to detect if they are near a runnable wall using the tag of the hit object, then I have some line traces to detect if the wall is to the right, left, below, or in front of the character controller. I currently have right/left working, but I’m having trouble with Down/In Front. Additionally, I would like to have the feet just face the hit object of the sphere trace, simplifying all of this and making it more universal. Here’s what I have for the Right Side Rotate, the Left Side is the same but with the Trace Range set to negative:
Unfortunately I can’t really help you that much with this because… You haven’t stated what the trouble is with Down/In Front!
What I will say is typically for a wall run it’s all illusion, you would have an animation playing right-side-up for it, and if you don’t want to do that you should simply rotate the static mesh and its children, not the entire actor because that throws off relative rotations and things get really dicey in the mathematics department!
Sorry, I guess I glossed over that. The Down/In Front directions just simply aren’t rotating correctly, I’m having trouble figuring out which way to rotate the actor, and the method I have currently doesn’t work well. But like I said, if I could figure out a way to just use the sphere project to figure out which way to rotate the mesh, that would solve the problem anyway.
So, I don’t know if I can edit the title of this post, because I guess I’m asking for something slightly different, but what I’m looking to do is replace my current system of rotating the actor to something that’s more universal. I’m thinking something along the lines of use a sphere project to get the impact point of a nearby surface, rotate the character mesh so the feet face the impact point, and the character’s forward direction faces the current forward velocity. Is this possible, and if so, how would I implement it in Blueprint? I currently have no Idea how to even begin doing this.
Don’t worry! I think you might be overthinking it a bit. It’s mostly going to be just simple math nodes.
Like, using the impact point, get the surface normal. That’d end up as your “wall’s forward” more or less. Then you’d figure out next if your character should follow the wall’s left or right. Then use “Set world rotation” using that to rotate your entire character, then rotate your static mesh to orient to the left or right, maybe with a bool based on if you’re following the left or right normal of the wall, as determined earlier in the code.
Wall running’s complicated.
But with many, SIMPLE nodes it can be done.
Basically, take the Hit Normal from the Sphere Trace and the Character Component’s current velocity and plug them into the Up and Forward of a Make Rotation from Axes node respectively. It’s a little janky, especially when running up walls, but running down them or to the side works well. Also the green nodes in the center determine if you’re below the wall running velocity. Hopefully that helps people who might have a similar problem.
Hey! I know that it’s a week later and I haven’t marked my last message as a solution, but that’s because I had a few suspicions about my awnser, specifically, the fact that I didn’t set a Right rotation axis. Well, I figured out what to do about that and the wall running is working flawlessly! Here’s the new nodes: