Movement along the wall

object should always move along the wall. How can I best implement this:

not necessarily, but the object should always move along the wall

But shouldn’t be static movement, but dynamic

Do you want the cube to rotate in the corner? There’s no space…

Yeah, bit of a fiddle.

I got it to move around inward corners, but not outward. Pretty messy code.

Might be easier to just use a spline and let the cube turn around corners.

I got it to work like so:

Image from Gyazo

The inward corners are just turns, the outwards are a tad more tricky:

  • we fire up to 2 linetraces to the side (depending on the direction of movement) of the actor
  • one from the back
  • one a bit to the front
  • if both traces fail, it’s time to turn

Splines were my first thought, too.

But shouldn’t be static movement, but

Nothing is stopping you from updating the spline dynamically. I’d take it even further and have the splines build the walls…

Not only would this be very dynamic but also would allow you to make curved and / or moving walls! And moving along a spline is very precise and efficient too.

But it may not fit the gameplay / game style, of course.

One thing that’s not accounted for is that we currently must start close to the wall. But that can be ironed out somehow, I’m sure.

Project link:

1 Like

thank you all for the great support!

1 Like