-
Notifications
You must be signed in to change notification settings - Fork 344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AntiColliderTile #321
Comments
You can turn off the TilemapCollider2D component with a script. You could do that with the StartUp function of the Tile, or through a GameObject attached to the Tile. |
Here's a script you can add to the TilemapCollider GameObject to check for the Tile and enable/disable the TilemapCollider: ` [RequireComponent(typeof(Tilemap))]
} |
We do have a script that does something like this in 2d-techdemos: https://github.com/Unity-Technologies/2d-techdemos/blob/master/Assets/Tilemap/IsometricZAsY/Scripts/ToggleHeightLevel.cs, which you could add onto a GameObject for the top of the stair Tile. This would require that the level is separated to different Tilemap Layers for a TilemapCollider2D for each height level. |
I´am currently have 2 Tilemaps (Terrain & Objects), each in own RenderLayer. The Tiles each self has differend z-Heights. The Stairs and Walls are on the Terrain Map. So i should add the Stairs to the Objects layer and the script? |
I think the best option is, changing the code where the collider of the tilemap is build up. Like make a boolean field in ruleTile for each Tile to set true or false when a Tile is one z-height over this tile, this should also make performance faster for collider build up. RuleTile A is checked "noColliderWhenOver", this means if any tile is at the same x & y coordinates but one z height higher, than this tiles collider is set to none at this place only. |
That is possible. This will allow you to link the Tilemap Collider you want in the Scene to the script.
Yes, that can be done. You could change the TileData.colliderType from Sprite to None to prevent a Tile from generating a collider, by comparing the height of the Tile with the height of your player for example. Recreating the collider from Tiles is quite expensive though, compared to enabling/disabling existing colliders from different Tilemap Layers. |
The Second Option should be better, because the collider is only build once, but i need to check the next tile at higher z-axis. |
i added a boolean field to the ruleTile, and inside the GetTileData Method i added this:
but it's not working. |
You could try to print out the Tile that is at I suspect that the Tile above would be at |
Nice its works 👯 Here the Code if you want to make a Final-Tile with 100 of Functions. i changed: RuleTile.cs
-> GetTileData() Add Line under
RuleTileEditor.cs Add Line under
|
Great news! |
Hello,
i need a option for a Negative Collider Tile, the function should be, there where this tile is placed, all tilemap colliders are removed on that point. so i can place it on special areas.
is this possible?
The text was updated successfully, but these errors were encountered: