Тёмный
No video :(

How to Make Simple Ladders in Unity | 5 Minute Unity Tutorials 

Octo Beard
Подписаться 6 тыс.
Просмотров 18 тыс.
50% 1

A short video showing how to make ladders that they player can go up or down on.
---
Good For You by THBD / thbdsultan​
Creative Commons - Attribution 3.0 Unported- CC BY 3.0
Free Download / Stream: bit.ly/2PgU6Mu​
Music promoted by Audio Library • Good For You - THBD (N... ​

Опубликовано:

 

28 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 64   
@octobeard4946
@octobeard4946 3 года назад
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; } } }
@charizzle5180
@charizzle5180 3 года назад
Was searching for ages to find a simple and working ladder code for my uni project, this was incredibly helpful. Thank you!
@octobeard4946
@octobeard4946 3 года назад
No worries man. I was in the same boat. Searching for ages. Couldn’t find one. So I made one. Glad it helped. 👍👍
@SkyLeon-iu3ee
@SkyLeon-iu3ee 2 года назад
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; } }
@kazrepair7219
@kazrepair7219 11 месяцев назад
thanks
@Visuwyg
@Visuwyg 3 года назад
what a pleasant tutorial! these are rare, I'll try to follow this tomorrow, but using Bolt.
@marianl8092
@marianl8092 Год назад
pretty cool! gonna turn a modification of this to a simple obstacle climbing, too.
@vincenzosparks2516
@vincenzosparks2516 3 года назад
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.
@ahmetomercicek5848
@ahmetomercicek5848 Год назад
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.
@HausCoding
@HausCoding 3 года назад
very helpful thankss!!
@lawrence4301
@lawrence4301 Год назад
your channel avatar is sick haha, nice
@octobeard4946
@octobeard4946 Год назад
Haha. Thanks 🐙
@AbyssalSoda
@AbyssalSoda 2 года назад
The type or namespace name 'FirstPersonController' could not be found (are you missing a using directive or an assembly reference?)
@lazikbro12
@lazikbro12 Год назад
mee to bc i have not installed standard assets from unity store
@soems6535
@soems6535 3 года назад
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
@malitver
@malitver 6 месяцев назад
I need an animation to trigger when climbing stairs, how do I do that?
@gmangman123
@gmangman123 Год назад
I can't stay on the ladder If I release the W key, the player slides down?
@KronosPGR
@KronosPGR 3 года назад
It works thanks! Btw how to enable the rotation of the camera while going up?
@octobeard4946
@octobeard4946 3 года назад
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...).
@KronosPGR
@KronosPGR 3 года назад
@@octobeard4946 i just copypaste muy rotation lines into the update of your script and works fine! Easy and useful thanks
@octobeard4946
@octobeard4946 3 года назад
@@KronosPGR That’s great. Happy to know it works with you controller. 👍👍
@lazikbro12
@lazikbro12 Год назад
nope my character cant exit the ladder
@gmangman123
@gmangman123 Год назад
yes I have same problem...
@pekaala7319
@pekaala7319 3 года назад
thank you bro
@octobeard4946
@octobeard4946 3 года назад
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. 👍👍
@ROSTUDIO224
@ROSTUDIO224 7 месяцев назад
Привет а если у меня свои код движение и персонаж как изменить
@aerothan4386
@aerothan4386 3 года назад
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
@octobeard4946
@octobeard4946 3 года назад
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
@benjamintinkhauser4500 3 года назад
@@octobeard4946 ive also got that problem. any ways to fix this now?
@octobeard4946
@octobeard4946 3 года назад
@@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
@octobeard4946 3 года назад
@@benjamintinkhauser4500 other than that, I’m afraid I don’t know. I’ve never used Photon.
@benjamintinkhauser4500
@benjamintinkhauser4500 3 года назад
@@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
@ilonpilaaja
@ilonpilaaja 2 года назад
Very Cool
@Shubham-bk2cf
@Shubham-bk2cf 3 года назад
How to make player look at ladder only while climbing?
@zarkaun96
@zarkaun96 Год назад
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?
@Nemko77
@Nemko77 3 месяца назад
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.
@MaximilianoDavidDucoli
@MaximilianoDavidDucoli 3 года назад
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
@RetroRedDog 2 года назад
Did you solve this? I am wanting to do the same
@MaximilianoDavidDucoli
@MaximilianoDavidDucoli 2 года назад
@@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!
@RetroRedDog
@RetroRedDog 2 года назад
@@MaximilianoDavidDucoli Thank you, yes sure if I can improve it I will send it over to you
@KamuCreates
@KamuCreates 3 года назад
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
@octobeard4946 3 года назад
Have you tried adding a second collider? Or a sub-model with its own collider on it...?
@KamuCreates
@KamuCreates 3 года назад
@@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!
@SkyLeon-iu3ee
@SkyLeon-iu3ee 2 года назад
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.
@drnovetti9392
@drnovetti9392 Год назад
does this also work with ThirdPerson starter assets?
@octobeard4946
@octobeard4946 Год назад
Should do. But there won’t be any climbing animations… unless you set them up.
@drnovetti9392
@drnovetti9392 Год назад
@@octobeard4946 love it! thanks for the tutorial
@octobeard4946
@octobeard4946 Год назад
Np 😊
@vladimirsantos2318
@vladimirsantos2318 2 года назад
How am i gonna make the ai use ladder?
@Visuwyg
@Visuwyg 3 года назад
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...
@octobeard4946
@octobeard4946 3 года назад
Glad I could be of help.
@twistypunch
@twistypunch Год назад
I can't even run the game with this script in the project. Does this not work with VRChat?
@user-re7sx8tj3r
@user-re7sx8tj3r 3 года назад
I tried to run the script but my character went under the map and kept dropping, what can I do?
@teamfury7484
@teamfury7484 2 года назад
When i enter the ladder my character start flying and when it lands i cant use my control
@iamthedislikebutton7899
@iamthedislikebutton7899 2 года назад
I'm here just incase
@hehehe8626
@hehehe8626 3 года назад
For me dont work pls help
@hehehe8626
@hehehe8626 3 года назад
i use 2018.4.35f1 and FPScontroller from unity standart assets
@benjamintinkhauser4500
@benjamintinkhauser4500 3 года назад
my character is just flying upwards when i start the game
@octobeard4946
@octobeard4946 3 года назад
Did you put the script on the player or on the ladder?
@benjamintinkhauser4500
@benjamintinkhauser4500 3 года назад
@@octobeard4946 On the player but i just fixed it. It was because of the character controllet
@octobeard4946
@octobeard4946 3 года назад
@@benjamintinkhauser4500 that’s great news. What was the fix (in case anyone else asks)??
@benjamintinkhauser4500
@benjamintinkhauser4500 3 года назад
@@octobeard4946 just remove the character controller component from the player, if youre using photon player controller
@octobeard4946
@octobeard4946 3 года назад
Thanks for letting me know. I’ll be sure to tell others having this problem. 👍👍
Далее
Why Stairs Suck in Games... and why they don't have to
11:24
Cutscene in Unity 3D | Timeline in Unity | CG Aura
14:13
28 Creating a Ladder in Unity
11:47
Просмотров 3,4 тыс.
Climbing System In Unity | Zelda Tutorial
4:24
Просмотров 30 тыс.
HOW TO MAKE 2D LADDERS IN UNITY - EASY TUTORIAL
8:01
How To Code Ledge Grabbing for your Unity Game
19:58
How To Make 2D Ladders In Unity
4:25
Просмотров 39 тыс.
Unity C#Tutorial: Opening A Door With A Key
14:20
Просмотров 17 тыс.
Climbing Ladders - Unity Tutorial
3:55
Просмотров 9 тыс.