Handle SLOPES in UNITY [SUPER EASY]

preview_player
Показать описание
Learn how to keep a player attached to the ground no matter what terrain in Unity! GitHub Repository of project available below!

JOIN THE DISCORD COMMUNITY:

GITHUB REPOSITORY OF PROJECT:

TIME STAMPS:
00:00 INTRO

CREDITS FOR SOUNDS AND MUSIC:

Song: Chime - Phototropic [NCS Release]

YouTube studio free music assets
Рекомендации по теме
Комментарии
Автор

This is one of the kind of videos that'll stay useful forever and will always attract views

DevNoob
Автор

I appreciate the details that you put into post-production with all the little highlights, sound effect and such. The explanation was easy but effective and understandable :).

leLawain
Автор

Holy crap this actually worked.
Only problem I had was that the length of the ray (which you set at 300f) was pushing my character way above the ground, I just switched that with the radius of my ground collision I originally had (about .2f). And it works beautifully.

Thank you so much! I'll definitely share this.

hipsterelephant
Автор

I love how you hide mario to avoid Nintendo copyrights xD

forksh
Автор

It works but when the player jump or when it have to walk on different level platforms it just make an strange jump and the camera just follows that weird movement.

jimix
Автор

Got a question. I'm using sprites and I made slopes for unity. So I had to wonder, can this script work on sprites or does it need to be in a solid object for handling slopes?

acediamonddog
Автор

one question. i have enemy characters in my game if i apply this to them will it work the same?

mileselectric
Автор

Would this method also work if you put it in a polymorphism script so it can apply to all characters in your game?

angeltripper
Автор

just one thing: can you combine it with rigidbody? because i use rigidbody to move my character, not using transform.position, also is it gonna mess up with the physic of the rigidbody ?

Strongest
Автор

why is -Vector2.up rathar than Vecto2.down?

meow
Автор

works with the new input system? I am using the new input system separating the logic from the controller but it is complcated? I ve not enough force to pass trhu the sloped platforemer.also I am using compositecolider2D in static and polygon collider for 2Dplateformre.

AstralNostalgia
Автор

Can i ask a question? I made my character with the box collider from the head to the belt and a circle collider for the belt to the feet. I using rigidbody2d for my character and the ground, the style of character is dynamic and ground is static. When i applied your method it still can't step on the stair. Is anything in the setup go wrong? could you have me fix this?

vyquaquay
Автор

I'm getting this error for the line with Physics.Raycast(...):

"Cannot implicitly convert type 'bool' to 'UnityEngine.RaycastHit' "

I'm doing this in 3d and so am using the 3d Raycast, but I wouldn't think that would make any difference. Any tips?

BitterTast
Автор

it worked! But now how do I make the character jump with Raycast?

AnibalRetro
Автор

Isn't 100f too much for a platformer? I think you wanted to make sure it work just for video right?

egeyaman
Автор

How can I use this system to create a one-way floor or slope?

eve_iblis
Автор

the type or namespace 'RaycastHit2d' could not be found (are you missing an assembly reference?)

defendersofthevalley
Автор

I have a problem hopefully someone can help when I use the layerMask at the end of the first script it's saying that it cannot convert from unity engine game object to int

makermovie
Автор

I'd love to say that this was exactly what I was looking for, because it kind of is, but unfortunately it doesn't work for me :( Idk if my scene is simply incompatible or what but yeah

cgillis
Автор

Thank you for the video. How I can do that in 3D?

SonGoku-wzes