CharacterController.SimpleMove breaks on locked axis

Hi,

I’m using CharacterController.SimpleMove to animate my characters. However, I want him to be locked to a particular plane so I added the simple axis locking script below:

        Vector3 pos = transform.position;
        pos.z = _initial_z;
        transform.position = pos;

However, it seems that this breaks SimpleMove’s handling of gravity. We’re not using rigidbodies and just want to keep the characters from wandering off course.

Is there a clean way to get this effect?

well, you could create a collider along the axis, that way you wont be able to restrain and modify the position.

hope it helps! :slight_smile: