My CubeDude was turning too slow



My player was changing direction too slowly. For example, walking left and right looked like this:

My solution was to look at not motion.x and .z times -speed, but times -speed * 100, or some other large number. This makes the character look at a far away point in the direction he is moving, and results in more instant turning like this:

There’s a sweet spot where he’s doing a little bit of a pivot when changing direction, rather than unrealistically snapping 180 degrees.

My final code looks like this:

func face_forward():
	var forward = motion * Vector3(-1, 0, -1) * speed * 5
	if forward.length() > EPSILON:
		look_at(forward, UP)


It’s not that he’s moving too slow, he’s facing away from the center(ish, a position at (-SPEED, 0, -SPEED) * movement). You can test this by getting stuck in the goal.

If the SPEED (or a modifier, as you’ve used) is large enough the position gets outside the bonds of the pitch and works fine. If the pitch is large enough, I’d imagine we’d run into the same problem again. But I guess you could use a much larger modifier value and it would be ok.

I added the player’s position to the facing direction and it seems to work fine as well. I don’t know what the best solution is.