Stuck in ground?

Hi, I am making a 2d platformer and there are places were you can fall down but sometimes when you fall down you get stuck in the ground. I was wondering if there is a way to make a button to make you teleport upwards a little as I don’t have a restart button and if you did you will have to start from the beginning and that is not that good of an idea so like a button on the keyboard or maybe a button on screen but anyway thank you for the help.

Have you investigated why it falls & gets stuck? If the player isn’t supposed to fall or jump you could clamp the y axis, or if they are meant to jump but not fall below a certain height put a check in that looks at the y position & if it is below a certain point reset it back to where it should be e.g
if (transform.position.y <0) transform.position.y=0;

Or something like that

@tedthebug The character is supposed to jump and fall but if it falls too fast and hits a platform it gets stuck in it btw I am not that old and I’m only new to unity so please don’t make stuff too complicated but thank you for replying in a short time

@tedthebug also in some cases you are able to get out but i only know that and there are only a few types of that platform that I have in the project

Ok, no worries. Have you done the tutorials? I’m asking so anyone reading gets an idea of what you know so far.

You need to work out why he is getting stuck. I’m assuming you are using a bool to determine if he is grounded so you know if he can jump. If that’s the case there’s a chance that the collision with the platform/hole isn’t setting the bool so it thinks he is still in the air.

Do you know how to debug & check what is being passed?

I am currently using the character that unity comes with in the 2d package and also when he gets stuck it looks like he is falling btw I can’t use unity currently

@tedthebug

Ok. I’d recommend that you park your own game for a while & do the tutorials as they will explain how it all works & get you used to unity. You don’t want to start with your own game while you are learning because you will get frustrated that it doesn’t work the way you want it to.

http://unity3d.com/learn/tutorials

Start with roll a ball then do space shooter. When you are confident you will be able to come back & look at what you’ve done & you will probably be able to sort it out.

At a guess I’d suggest you have an issue with the colliders on your character & platforms.

1 Like

Thank you for the support @tedthebug

Good luck

1 Like

Click on your character, then from the inspector select RigidBody2D and make sure Collision Detection is set to Continuous

1 Like

Thank you @skinwalker_1 it helped a lot
β•šβ•( Ν‘Β° ΝœΚ– Ν‘Β°)═╝
β•šβ•(β–ˆβ–ˆβ–ˆ)═╝
β•šβ•(β–ˆβ–ˆβ–ˆ)═╝
.β•šβ•(β–ˆβ–ˆβ–ˆ)═╝
β€¦β•šβ•(β–ˆβ–ˆβ–ˆ)═╝
β€¦β•šβ•(β–ˆβ–ˆβ–ˆ)═╝
β€¦β•šβ•(β–ˆβ–ˆβ–ˆ)═╝
β€¦β•šβ•(β–ˆβ–ˆβ–ˆ)═╝
.β•šβ•(β–ˆβ–ˆβ–ˆ)═╝
β•šβ•(β–ˆβ–ˆβ–ˆ)═╝
.β•šβ•(β–ˆβ–ˆβ–ˆ)═╝
β€¦β•šβ•(β–ˆβ–ˆβ–ˆ)═╝
β€¦β•šβ•(β–ˆβ–ˆβ–ˆ)═╝
β€¦β•šβ•(β–ˆβ–ˆβ–ˆ)═╝
β€¦β€¦β•š(β–ˆβ–ˆβ–ˆ)╝
β€¦β€¦β•š(β–ˆβ–ˆ)╝
………(β–ˆ)
……….*