Make character snap to the centre of the ladder-

-instead of being able to climb along the corners

Ive thought of making my ladder and player colliders as thin as possible but that doesnt seem very ideal. How should i achieve it?

Hi,

What do you mean by “snap”? Actual snapping? If so, you will have to override the player’s x-position while climbing.

Otherwise, making the collider thin is a good idea. However, the player will fall off the ladder while not climbing in the center of the ladder. Maybe that’s what you want?

If not, please elaborate on your idea and the problems you encountered a bit further because “that doesnt seem very ideal” is very vague. Nobody knows that you deem “ideal”, so it is impossible to make any suggestions regarding a solution for an “ideal” result.

Yes overlapping players x position is exactly what i want. I just dont know what i need to set it to…

Probably the ladder’s x position (or its collider)
You can get the x position of the object you’re colliding with by using

    //Use the 2D counterparts if your game is 2D
private void OnCollisionEnter(Collision other) {
        other.gameObject.transform.position.x;
}
    // Or if your collider is set to Trigger:
private void OnTriggerEnter(Collider other) {
        other.gameObject.transform.position.x; 
}

Use it with the Tag functionality to check if the object is a ladder and set the player x position then.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms