I have a problem that the when the player touches the ladder it becomes infinite like neverending ladder. I know where the problem is but I dont know ho to fix it. In ontriggerenter it is turning off his collider and the there is nothing to check that the player is out
Not sure why the collider would be disabled while in the ladder trigger. I don't believe any of the code disables the players collider. Maybe try checking the ladder height to be sure the player exits the trigger.
exactly what i did in my script...Only,my character sort of jitters at the top of ladder.Not sure how to fix it.But if i don't let go W key,all is fine.How about jumping from ladder to ladder,or from wall to wall?Would be interesting for some kind of adventure/action platformer(2.5D side scroller)
Hi, this is really good but my player is getting stuck going up the ladder for some reason. Didn't know if you ever experienced this issue with ladders before.
make a platform and put it little bit above the ladder and place it behind then after getting up the ladder press w to climb up the platform. Hope this solves your problem. :)
my character stays on ladder and cant exit it and press s doesnt work
It Works Like a Charm! Here ya go the code.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LadderScript : MonoBehaviour
{
public Transform playerController;
bool InsideLadder;
public float LadderHeight = 3.3f;
public PlayerMovement playerInput;
void Start()
{
playerInput = GetComponent();
InsideLadder = false;
}
private void OnTriggerEnter(Collider col)
{
if(col.gameObject.tag == "Ladder")
{
playerInput.enabled = false;
InsideLadder = !InsideLadder;
}
}
private void OnTriggerExit(Collider col)
{
if(col.gameObject.tag == "Ladder")
{
playerInput.enabled = true;
InsideLadder = !InsideLadder;
}
}
void Update()
{
if(InsideLadder && Input.GetKey("w"))
{
playerController.transform.position += Vector3.up/LadderHeight;
}
}
}
THANK!!
I have a problem that the when the player touches the ladder it becomes infinite like neverending ladder. I know where the problem is but I dont know ho to fix it. In ontriggerenter it is turning off his collider and the there is nothing to check that the player is out
Not sure why the collider would be disabled while in the ladder trigger. I don't believe any of the code disables the players collider. Maybe try checking the ladder height to be sure the player exits the trigger.
exactly what i did in my script...Only,my character sort of jitters at the top of ladder.Not sure how to fix it.But if i don't let go W key,all is fine.How about jumping from ladder to ladder,or from wall to wall?Would be interesting for some kind of adventure/action platformer(2.5D side scroller)
Thank you for this tutorial!
Hi, this is really good but my player is getting stuck going up the ladder for some reason. Didn't know if you ever experienced this issue with ladders before.
make a platform and put it little bit above the ladder and place it behind then after getting up the ladder press w to climb up the platform. Hope this solves your problem. :)
@@sandeepanchoudhury-8j-164 me. nope still
thank you so much
wow this worked great, thanks!