2d-extras icon indicating copy to clipboard operation
2d-extras copied to clipboard

Object getting stuck between tiles

Open Coosis opened this issue 5 years ago • 7 comments

Using composite collider doesn't work. I used a boxcollider2D and I got stuck between tiles. Object cannot move from one tile to another. It always stop at the edges(with gravity enabled).

Coosis avatar May 02 '19 00:05 Coosis

Could you share images of your Collider2Ds in the scene?

The CompositeCollider2D can only take effect if the other Collider2Ds have the "Used By Composite" set. The CompositeCollider2D also needs to be placed at the same level at the Collider2Ds or in a parent GameObject.

ChuanXin-Unity avatar May 03 '19 09:05 ChuanXin-Unity

nope. its not working. here are the pictures: Tilemap PlayerObject

Coosis avatar May 03 '19 10:05 Coosis

Could you show the SceneView where the objects are stuck?

ChuanXin-Unity avatar May 03 '19 10:05 ChuanXin-Unity

Scene here

Coosis avatar May 03 '19 10:05 Coosis

I guess capsule collider is the best solution after all. But thanks your time anyway.

Coosis avatar May 03 '19 11:05 Coosis

Hi, having a capsule collider for your character would be good for smoother movement. However, based on your screenshot, the blocks do not seem to be fully composited by the Composite Collider 2D? Meaning that the blocks should be fused to a single shape or neighbouring blocks should share the same edges where possible.

ChuanXin-Unity avatar May 09 '19 02:05 ChuanXin-Unity

2019/7/25 Well, i tried doing that but composite doesn't seem to be doing the work properly. No matter what i do, it never regenerates a collider without some lines in the exact same place of the edges between tiles before i added a composite2D, which means adding it didn't solve the problem. But i solved my problem at last - by altering my boxcollider2D's Edge Radius from 0 to 0.01. Not sure what caused it, but a lot of people have this problem, seems to be the engine's problem.

maybe more methods here -https://forum.unity.com/threads/rigidbody-getting-stuck-on-tiled-wall.220861/

Coosis avatar Jul 25 '19 14:07 Coosis