- Home /
Character Controller Upward Movement Along Concave Surface
Hi,
I'm noticing some strange / inconsistent behaviour with Character Controller that I can't understand and I'm wondering if anyone knows how it's working internally, or why this might be happening.
The very basic setup I have to demonstrate the issue is like this: A capsule with a Character Controller attached to it A wall leaning slightly towards the capsule A script that moves the capsule every frame
You'll notice that the wall is leaning towards the positive X axis. This is just to simplify the issue even further.
If my MoveTest script looks like this
public class MoveTest : MonoBehaviour
{
private CharacterController controller;
// Start is called before the first frame update
void Start()
{
controller = GetComponent<CharacterController>();
}
// Update is called once per frame
void Update()
{
controller.Move(new Vector3(0, 1f, 0) * Time.deltaTime);
}
}
When the capsule hits the wall as it travels upwards, it is adjusted towards positive X so that it tracks along the wall as it moves upward.
However, if I change the script to this:
public class MoveTest : MonoBehaviour
{
private CharacterController controller;
// Start is called before the first frame update
void Start()
{
controller = GetComponent<CharacterController>();
}
// Update is called once per frame
void Update()
{
controller.Move(new Vector3(0, 1f, 1f) * Time.deltaTime);
}
}
the behaviour is different. This time when the capsule hits the wall, it only moves in the Z direction and stops moving upward. Its upward movement is blocked rather than the Character Controller pushing it towards Positive X and allowing it to continue to move upward as before. This seems odd, because the movement I gave it in Z is perpendicular to the wall, so theoretically it shouldn't affect what happens in Y and X.
It's almost as if Character Controller is checking both X and Z for any velocity and not allowing any modification of position if either of those are not 0, which in turn prevents upward movement.
This issue means I'm having trouble when my character jumps and hits a slightly angled-in wall. Ideally, I would want them to track along the wall and continue moving upward rather than hitting their head and falling immediately.
Any explanation for this, or maybe a workaround would be appreciated.
Thanks
Your answer
Follow this Question
Related Questions
Shift BHOP in Character Controller 0 Answers
Player acts weirdly when I release movement input 0 Answers
I can't do that my character jumps while running 0 Answers
Cannot jump while running downhill,Character can't jump while moving down 0 Answers
CharecterController.Move() ignores parents movement 0 Answers