Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411640 Posts in 69394 Topics- by 58449 Members - Latest Member: pp_mech

May 14, 2024, 10:33:59 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Unity 2D Platformer player stuck on tile-based floor
Pages: [1]
Print
Author Topic: Unity 2D Platformer player stuck on tile-based floor  (Read 4545 times)
AlexL0604
Level 0
**


View Profile WWW
« on: October 01, 2017, 10:51:06 PM »

Hello everyone!! I'm newbie to game development and self-studying game development.
I'm now making a 2D Platformer.  And I've used TileMapEditor to create the map and used Tile2Unity to export the map including the collision of the floor and other platform.
However, the player would stuck on the floor Facepalm Facepalm (https://www.youtube.com/watch?v=7PgHGOjlnSs&feature=youtu.be)
I think it is related to the colliders but I've tried and cannot solve the problem.

the colliders are like this:
player is using box collider2D and the exported tile floor is using the polygon collider2D
Logged
diegzumillo
Level 10
*****


This avatar is so old I still have a some hair


View Profile WWW
« Reply #1 on: October 04, 2017, 11:02:03 AM »

You're using the physics system I assume. Most games that use the physics system as main way of controlling a character use round colliders to get around this issue. If you want a precise platformer feel to it then you need to make your own collision system with traces and snap to walls and all that suff.
Logged

bateleur
Level 10
*****



View Profile
« Reply #2 on: October 04, 2017, 10:16:49 PM »

Unity's physics systems do not guarantee to prevent overlap, since this is very difficult to do in the general case.

One hack which might help is to extend the floor colliders so that they overlap one another by about half the width of the character. This will prevent the corrective forces from collisions with the floor being applied parallel rather than perpendicular to the surface.
Logged

AlexL0604
Level 0
**


View Profile WWW
« Reply #3 on: October 07, 2017, 09:48:26 PM »

Thank you for replying my question! I just thought there won't be anyone to answer my question hahaha so I had tried to solve it myself and it is finally solved!!
Just like the solution that was mentioned by bateleur, that is to extend the colliders of floors.
I think this situation happened coz of the gaps between each floor tiles' collider so it makes the player may stuck on it.
Anyway thank you for dudes who are trying to help me out!! Toast Left Toast Left Toast Left
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic