Here is same code with slight modification I had to use Time .deltaTime to reduce speed of movement of my character while inside of box,which doesn't have to be bad...Without it,Box can be used as cannon,you only apply gravity after exiting of box... Here is part of code i modified: void Update() { if (inside == true && Input.GetKey(KeyCode.W)) { charCTRL.transform.position += Vector3.up * speedUpDown * Time.deltaTime; } if (inside == true && Input.GetKey(KeyCode.S)) { charCTRL.transform.position += Vector3.down * speedUpDown * Time.deltaTime; } }
I did everything and it worked but the ground terrain is attached and when I don't press the w key on the ladder, it starts to fall down, how can I solve this problem, thank you.
The script sorta works, the player will enter the trigger and climb up but never exits when it gets to the top, instead just starts to head down. Also player gets stuck/freeze if it lands on top of the trigger. Not sure if you could maybe point me in the right direction? I'm using photon for the player controller
I’ve never used Photon before, but there have been some issues with its colliders. This page here might help: forum.unity.com/threads/photon-players-go-through-each-other.822654/
@@benjamintinkhauser4500 Is this for a multiplayer game? There is something on this here: www.google.co.uk/amp/s/amp.reddit.com/r/Unity3D/comments/3x1eus/character_controller_with_photon_networking/
@@octobeard4946 Yes its for a photon multiplayer game. The ladders work but i cant get out of the hitbox if im on top. And on ground i cant move if im next to the ladder
Excellent video. So I'm running into an issue where when I go up the ladder, and then back down, the character goes down the inside of the ladder (the side that is against the wall). Any idea on how to fix this?
After a year maybe you solved it already, but if not, just simply change the size of the collider. I have the collider infront of the ladder, so when the player obj. interacts with it, it's not going to be "inside" the ladder or wall.
This tutorial was amazing and so are you, Sir! :) Looks like I'm getting stuck at the top (not using Photon) as well. But, I should be able to figure it out.
Hi. Thanks for getting in contact. This script does not support that feature as it disables the whole FPS Input for the duration of the climb. You’d need to look at just disabling the movement controls (but not the look controls), but this could get quite messy as the look controls determine which way is forward (and so which way is sideways and - most importantly - up...).
when i enter the ladder collider and press w, my character flings upwards, and when I press s, my character falls under the map. I made sure that the collider is slightly offset upwards from the bottom of the ladder, so I'm not really sure what I did wrong. any help is appreciated ty. edit: nvm i fixed it, but in case someone else encounters this problem, try setting the ladder mvmt speed a little higher. i set mines to around 30 which resulted in a steady climb speed
Hi. man! Great tutorial! Do you know how can i made a ladder, but in 2.5D Just like ghost'n goblins have. I can´t made it yet. Sorry my poor english, but i speak spanish. Tank you!
@@RetroRedDog I still couldn't finish doing it properly, but since I'm just in the prototype of my game, for now they are just tests and later when I have everything well thought out, I will make the corresponding arrangements. If you improve it before me, please, I ask you if you pass me the corrections. In the player controller there are some interactions too, that's why I attached it to the package. drive.google.com/drive/folders/12tD1lSm678nlLouCrl-cfcBpoYkQdQvY?usp=sharing Thanks a lot!
this is great! I'm just learning Unity and trying to keep things simple. I managed to tweak this for a crude 3rd person view but I am wondering if its Possible to get this to work with collision, I have platforms i need my character to have to move around but they just go right through.
@@octobeard4946 i figured it out! I tried using stoppers like i saw in another video where they set it to move you in the opposite direction, but if the collision wasn't totally on it would move you in the wrong direction and the only fix on that was 4 offset colliders which was way too much stuff. A friend suggested using the y velocity instead of transform to move the character controller and that solved the issue!
I translated your tutorial into Bolt Visual Scripting and it worked first try! Unfortunately, your solution is rather limited, the camera is locked and getting off the ladder is very finnicky. Going down a ladder is near impossible. Thanks for the quick win but I'll need a "proper" solution...
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityStandardAssets.Characters.FirstPerson;
public class ladderScript1 : MonoBehaviour
{
public Transform chController;
bool inside = false;
public float speedUpDown = 3.2f;
public FirstPersonController FPSInput;
void Start()
{
FPSInput = GetComponent();
inside = false;
}
void OnTriggerEnter(Collider col)
{
if(col.gameObject.tag == "Ladder")
{
FPSInput.enabled = false;
inside = !inside;
}
}
void OnTriggerExit(Collider col)
{
if(col.gameObject.tag == "Ladder")
{
FPSInput.enabled = true;
inside = !inside;
}
}
void Update()
{
if(inside == true && Input.GetKey("w"))
{
chController.transform.position += Vector3.up / speedUpDown;
}
if(inside == true && Input.GetKey("s"))
{
chController.transform.position += Vector3.down / speedUpDown;
}
}
}
Was searching for ages to find a simple and working ladder code for my uni project, this was incredibly helpful. Thank you!
No worries man. I was in the same boat. Searching for ages. Couldn’t find one. So I made one. Glad it helped. 👍👍
Here is same code with slight modification
I had to use Time .deltaTime to reduce speed of movement of my character while inside of box,which doesn't have to be bad...Without it,Box can be used as cannon,you only apply gravity after exiting of box...
Here is part of code i modified:
void Update()
{
if (inside == true && Input.GetKey(KeyCode.W))
{
charCTRL.transform.position += Vector3.up * speedUpDown * Time.deltaTime;
}
if (inside == true && Input.GetKey(KeyCode.S))
{
charCTRL.transform.position += Vector3.down * speedUpDown * Time.deltaTime;
}
}
thanks
I did everything and it worked but the ground terrain is attached and when I don't press the w key on the ladder, it starts to fall down, how can I solve this problem, thank you.
pretty cool! gonna turn a modification of this to a simple obstacle climbing, too.
y u check if w is pressed instead of checking for vertical input?
what a pleasant tutorial! these are rare, I'll try to follow this tomorrow, but using Bolt.
I need an animation to trigger when climbing stairs, how do I do that?
your channel avatar is sick haha, nice
Haha. Thanks 🐙
I can't stay on the ladder If I release the W key, the player slides down?
The script sorta works, the player will enter the trigger and climb up but never exits when it gets to the top, instead just starts to head down. Also player gets stuck/freeze if it lands on top of the trigger. Not sure if you could maybe point me in the right direction? I'm using photon for the player controller
I’ve never used Photon before, but there have been some issues with its colliders. This page here might help: forum.unity.com/threads/photon-players-go-through-each-other.822654/
@@octobeard4946 ive also got that problem. any ways to fix this now?
@@benjamintinkhauser4500 Is this for a multiplayer game? There is something on this here: www.google.co.uk/amp/s/amp.reddit.com/r/Unity3D/comments/3x1eus/character_controller_with_photon_networking/
@@benjamintinkhauser4500 other than that, I’m afraid I don’t know. I’ve never used Photon.
@@octobeard4946 Yes its for a photon multiplayer game. The ladders work but i cant get out of the hitbox if im on top. And on ground i cant move if im next to the ladder
does this also work with ThirdPerson starter assets?
Should do. But there won’t be any climbing animations… unless you set them up.
@@octobeard4946 love it! thanks for the tutorial
Np 😊
Excellent video. So I'm running into an issue where when I go up the ladder, and then back down, the character goes down the inside of the ladder (the side that is against the wall). Any idea on how to fix this?
After a year maybe you solved it already, but if not, just simply change the size of the collider. I have the collider infront of the ladder, so when the player obj. interacts with it, it's not going to be "inside" the ladder or wall.
very helpful thankss!!
This tutorial was amazing and so are you, Sir! :) Looks like I'm getting stuck at the top (not using Photon) as well. But, I should be able to figure it out.
It works thanks! Btw how to enable the rotation of the camera while going up?
Hi. Thanks for getting in contact. This script does not support that feature as it disables the whole FPS Input for the duration of the climb. You’d need to look at just disabling the movement controls (but not the look controls), but this could get quite messy as the look controls determine which way is forward (and so which way is sideways and - most importantly - up...).
@@octobeard4946 i just copypaste muy rotation lines into the update of your script and works fine! Easy and useful thanks
@@KronosPGR That’s great. Happy to know it works with you controller. 👍👍
when i enter the ladder collider and press w, my character flings upwards, and when I press s, my character falls under the map. I made sure that the collider is slightly offset upwards from the bottom of the ladder, so I'm not really sure what I did wrong. any help is appreciated ty.
edit: nvm i fixed it, but in case someone else encounters this problem, try setting the ladder mvmt speed a little higher. i set mines to around 30 which resulted in a steady climb speed
three years later, thank you for this!
The type or namespace name 'FirstPersonController' could not be found (are you missing a using directive or an assembly reference?)
mee to bc i have not installed standard assets from unity store
How to make player look at ladder only while climbing?
Hi. man! Great tutorial!
Do you know how can i made a ladder, but in 2.5D
Just like ghost'n goblins have.
I can´t made it yet.
Sorry my poor english, but i speak spanish.
Tank you!
Did you solve this? I am wanting to do the same
@@RetroRedDog
I still couldn't finish doing it properly, but since I'm just in the prototype of my game, for now they are just tests and later when I have everything well thought out, I will make the corresponding arrangements.
If you improve it before me, please, I ask you if you pass me the corrections.
In the player controller there are some interactions too, that's why I attached it to the package.
drive.google.com/drive/folders/12tD1lSm678nlLouCrl-cfcBpoYkQdQvY?usp=sharing
Thanks a lot!
@@MaximilianoDavidDucoli Thank you, yes sure if I can improve it I will send it over to you
this is great! I'm just learning Unity and trying to keep things simple. I managed to tweak this for a crude 3rd person view but I am wondering if its Possible to get this to work with collision, I have platforms i need my character to have to move around but they just go right through.
Have you tried adding a second collider? Or a sub-model with its own collider on it...?
@@octobeard4946 i figured it out! I tried using stoppers like i saw in another video where they set it to move you in the opposite direction, but if the collision wasn't totally on it would move you in the wrong direction and the only fix on that was 4 offset colliders which was way too much stuff. A friend suggested using the y velocity instead of transform to move the character controller and that solved the issue!
void Update()
{
if (inside == true && Input.GetKey(KeyCode.W))
{
charCTRL.transform.position += Vector3.up * speedUpDown * Time.deltaTime;
}
if (inside == true && Input.GetKey(KeyCode.S))
{
charCTRL.transform.position += Vector3.down * speedUpDown * Time.deltaTime;
}
}
this helped me, try it out.
Привет а если у меня свои код движение и персонаж как изменить
How am i gonna make the ai use ladder?
nope my character cant exit the ladder
yes I have same problem...
I can't even run the game with this script in the project. Does this not work with VRChat?
I tried to run the script but my character went under the map and kept dropping, what can I do?
Very Cool
thank you bro
No worries, dude. I noticed that there weren’t any decent tutorials for this so I thought I’d make one. It’s simple. But it does the job. 👍👍
When i enter the ladder my character start flying and when it lands i cant use my control
I translated your tutorial into Bolt Visual Scripting and it worked first try! Unfortunately, your solution is rather limited, the camera is locked and getting off the ladder is very finnicky. Going down a ladder is near impossible. Thanks for the quick win but I'll need a "proper" solution...
Glad I could be of help.
my character is just flying upwards when i start the game
Did you put the script on the player or on the ladder?
@@octobeard4946 On the player but i just fixed it. It was because of the character controllet
@@benjamintinkhauser4500 that’s great news. What was the fix (in case anyone else asks)??
@@octobeard4946 just remove the character controller component from the player, if youre using photon player controller
Thanks for letting me know. I’ll be sure to tell others having this problem. 👍👍
I'm here just incase
For me dont work pls help
i use 2018.4.35f1 and FPScontroller from unity standart assets