Hello Guest

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - woca

Pages: [1]
1
Support / Tilemap duplicating prefab
« on: April 30, 2015, 07:56:39 pm »
I have run into an issue where the tilemap is duplicating the prefabs associated with tiles.

If I destroy a tile/prefab by hitting it with a raycast, I have a switch/case area that then deletes the prefab associated with that tile and chooses the case based on the tiles ID. If the tile ID matches the door, turn off the door script and remove the meshcollider before deleting the prefab, then set the tile to the floor tile and build the tilemap.

Another case is for a generator where it just needs to delete the game object then set the tile to the floor tile then build the map.

Now when I delete a tile, regardless of whether a prefab is tied to it, there is a chance that all the prefabs in that chunk will be duplicated.

I saw this post seemed to have this issue http://2dtoolkit.com/forum/index.php/topic,4426.msg20784.html#msg20784
however you addressed it in emails.

Was anything figured out? Was it the way they were handling setTile and Build?

Some help would be great!

2
Support / GetTileAtPositon reporting strange results
« on: April 08, 2015, 10:35:43 pm »
I am currently performing a ray cast from a character towards the mouse, checking the position of the raycast hit, running that position through GetTileAtPosition, then removing the tile that is at the reported coordinates.

If I know the ray is hitting the top of the tile (8,0) and each tile is 1 world unit by 1 world unit and my collision is reporting it hit at coordinates ( 7.5, 1.0, 0.0) and I pass that vector through GetTileAPosition most of the time I get tile (8,1) which I don't want. I sort of get it though, the tile takes up the space from (7.00 to 7.99, 0.00 to .99) or something similar so hitting the top of the tile (8,0) hits at world y coordinate 1.0 so GetTileAtPosition thinks it is hitting the tile above what I actually hit. This is a problem by itself and is made worse by the fact every now and then the hit will still be at (7.5, 1.0, 0.0) and GetTileAtPosition actually returns 8,0 and deletes the tile I want.

EDIT - even though the hit is reporting 7.5, 1.0, 0.0 the float values are actually a little different. So a raycast that reports it hit (7.5, 1.0, 0) might actually hit (7.5, .93215, 0). Another time a hit reporting (7.5, 1.0, 0) might have float values at (7.5, .9501 0.0).

I tested a little more and for that occasional time when the tile I want to delete is deleted, the GetTileFRACAatPosition is returning .999999 as they y. When it is not deleting the one I want it is returning 1.

It just happens certain raycasts will report a hit at a vector that if passed through GetTileFRACAtPosition will report for the example above a Y value .999999 even while almost any other hit on that tile will report a Y of 1.0.

So whenever I hit the top of a tile or the right side of the tile 99% of the time when I get the vector of the raycasthit and pass it through a GetTileAtPosition or GetTileFracAtPosition it reports the tile either above what I hit or the tile to the right of what I hit.

Pages: [1]