Actor Rotation while walking on walls/ceilings

So, I have this creature design, like a lot of old-school sidescrollers, to add an enemy that walks on the ground, then when they get to an edge, rotate along the edge, to move down it, then underneath the platform along the ceiling, and so forth. Right now I have the movement parts working, but I can’t figure out how I’m going to rotate this guy. Any ideas how I could rotate the actor to face the surface he’s supposed to be attached to? I could probably get it working fine if it was all 90 degree angles, but I want him to be able to walk along any edge (like in the sidescroller template, the diagonal edge shown below). Below I put an image of the proxy for the actor, and the nodes that he follows. Is there another way to do this? Maybe splines or something? Let me know what you guys think!


I’ve also tried using the Lookatrotation between the actor and the point node, but once the rotation passes 90 degrees (negative or positive), it flips the character so he’s upright again, an so inside the platform mesh

You’re clinging to a mesh at some point, correct? Maybe a line trace from a point on the npc to a point on the mesh? Look at the line trace hit, there should be a normal vector for the surface you hit. Invert that and consider it “up”.

If you want more precision you could use multiple attachment points and blend between them.

Ok so I figured it out. Ended up doing the node way but thanks Veovis Muad’dib! The node way ended up giving me more control. I’ll explain here in case anyone else wants to do something similar and needs help.

First you need two actors, one that’s the creature or whatever moving along path, another representing a node. Here’s a bit of the node script, that lets you get the look location of the object you want the node to point at (aka another node along the path).


LookAt is a variable of whatever node actor you create (I just call mine node). If you set it to editable, you can change it in the editor after placing the actor. So, you place some nodes around, then decide which node you want this node to point at, set it, and because it’s in the construction script, it does it automatically. Then, if you clear it, you can make further changes to it’s rotation and or pitch. For me, I just rotated the upside-down portions of the path to rotate so the up vector of the creature actor would face down.

After you do that, you got to set up the creature, here’s some variables I used:


The movement nodes and newmovementorder are both set to the node actor type, and are an array. Set the movement nodes variable to editable, so you can edit them in the editor. You place the creature down, then pick which nodes you want the creature to move to, and in the order you want them to move in. Speed is straight forward. Looping? is a boolean variable and you set it based on what behavior you want the creature to have. If you set it to true, it will do as it says, loop through the movement nodes vector constantly, so once it gets to the last node in the list, it will move towards zero then start the path again. If you set it to false, it will instead reverse direction after hitting the last node. Then once it hits the first node again, it will reverse to follow the primary order again, and back and forth. Here’s all the blueprints for that:


That should just about do it. I also used two arrow components, one green and one red to show the up vector and forward vector of the nodes to help plan the movement of the creature. Those are attached to the node actor. Let me know if you have any questions but I’ve included all the blueprints I used.