At the moment unity just seems to make a new box shape for each tile:
do we have options to set sloped / different shaped tiles?
Lots of boxes in a row isn’t ideal for unity’s 2d physics as things can potentially catch on the joins - could the collider be created more magically so that surfaces (ie. floors and walls) are a single polygon edge?
I’m also interested in that. Right now for my little test project I have created sloped tiles by creating a prefab with a handmade polygon collider that I attach to a tile. I created a slope Tile layer so the slope tiles aren’t included in the main polygon collider.
My ideal solution would be a tile collision editor that can be accessed via the palette, kind of like in Tiled Map Editor. On some tiles one might only want an Edge collider, for instance (jump-thru platforms).
Speaking of Edge Collider - 1 way platform effector, it would be good to give it some thorough testing to ensure it is suitable for arcade style platforming gameplay - I believe currently there are problems if the character starts a jump while intersecting the collider
We experimented with editing the collision for tiles, but quite a few things to figure out before we have something to preview. In the meantime work is on going on the TileMapCollider2D. Currently uncertain when it will be ready but here’s a sneak of what’s in the works.
That’s interesting! In the video you can see the spikes really want to be a separate thing so that they’re interactable - would be good to have a standard way to add interactive objects to the grid
Whilst not in the preview, the TileMapCollider2D will produce per-tile colliders from a TileMap and there’s options already per-tile of how to turn a tile into a collider shape such as off, grid-shape, sprite etc. If you add a CompositeCollider2D you can blend multiple colliders including TileMapCollider2D together. How you separate your tile-maps, colliders and composites will be totally up to you. The trick will be using multiple tile-maps as ‘layers’ but you can also blend-in ad-hoc stock colliders into it as well.
You can see various videos on my Twitter feed here: x.com if you’re interested in seeing more.
This is amazing work! This should be in this preview - any idea when it will be available to test? Hard to feedback on the 2d tools until it’s a full ecosystem
Thanks, appreciate that. Unfortunately, It’s still a WIP so didn’t make the first preview but it’s very close to complete, certainly for the next preview. The existing physics support for TileMap, as is stated somewhere in the preview release notes, is temporary and will be ripped-out and burned and replaced with the above.
@MelvMay
Is there any 3D equivalent of the new CompositeCollider2D for 3D geometry planned or in the works yet?
I know it may be premature to ask, but I really do want to be sure we get something that makes the user-implementation easy as pie for both 3D and 2D jumpthrough platforms (and slopes) at some point! The only true 2D physics-engine stuff that’s left to do after this is adding the possibility of poly-editing the meshes of our sprites to give us the ability to create FFD animation natively for our 2D sprite images – and native integration with Unity’s 2d collision system would be a huge plus in terms of ease-of-use and versatility! We can then finally animate individual sprite mesh vertices, and any in-game character or environmental physics and visuals imaginable truly would be possible (and easy!) to make in Unity without needing expensive special-made tools!
The stuff mentioned here is some of the most difficult things to do, and especially to get right! I’m loving getting to witness how you guys simply crash through these problems with such elegant and user-friendly solutions! It’s your hard work in the physics department that made me switch to Unity in the first place! Nobody else even comes close to you guys!
If you want to use Unity’s 2D Physics, one of the earlier live training sessions has a great starting point. I don’t like the feel of these physics-based controllers so I use raycasting and transform.Translate directly to move my sprites around. It also feels more “arcadey”. It’s a bit more complicated but I find it makes things like slopes and jumpthru platformers easier to handle. Feel free to DM me, happy to share.
I’m testing out multiplayer using the new Tilemap system. Because of that, I need to “Build & Run” the game to be able to connect with a second player. Unfortunately, after building the game, the existing temporary physics solutions for tilemaps (attaching a Polygon Collider 2D) doesn’t seem to work anymore. At least not when I attach it at runtime (for procedural generation). Is there a temporary fix for this, or do I need to wait for the real TileMapCollider2D? (looks amazing btw!)