Raycasting wont Work

Im creating a 3D Maze game that has procedurally Generated mazes but it wont raycast

2 Likes

The reason why your tilemaps cannot raycast was because something to do witwith the set tile to block color to and the tile and the wall, because that creates a tile instead of a tilemaps, it will make it plain 2d instead of 3d. The setTile block was not generated as 3d because it was just a tile not meant for making the view like a 3d maze, instead draw your tilemap using the set tilemap to instead of using set tile with a color placing that would just not able to raycast. The reason behind this is because you are just adding a tile original tiles are still 2D so the raycasting extension is meant for tilemaps so that is a reason why it won’t raycast only if you drew the tilemap on the screen. Here is the accurate link so you can view the code for the game. https://arcade.makecode.com/S70205-75113-06586-90199 You can add the tiles just by drawing the tiles on the set current tilemap and makes it much simpler then well done it renders properly now, I did not add the tiles though, but I did think I fixed the bug why it could not raycast.

1 Like

Still doesn’t work

2 Likes

Sorry about that! I think the problem is that some set tile blocks with set color to from a tilemap extension are still in your project. These tiles don’t belong in the current tilemap, which is why raycasting doesn’t work.

Instead, delete those blocks and use the set current tilemap block to draw your tiles, or use the gallery. This ensures the tiles are part of the tilemap and can be raycast properly.

Also, I recommend deleting the tilemap extension block as well, because it doesn’t seem to connect with the tilemap data correctly. Here’s a picture to show what I mean:
image
Instead of using that block, draw your own tilemap and add tiles/mazes so it renders properly. Using the extension’s block could cause the tilemap to stay 2D even when it’s supposed to be rendered in 3D.

I didn’t actually draw the tilemap here, but this image shows the idea, and I think it should help fix the problem. Here’s the code:

1 Like

The 3D extension does not work with color coded tilemaps, because they aren’t really tilemaps, so the 3D extension cannot see the tiles.
Maybe it would work if you made some code that goes through each row and column of the map image and places a tile on a normal tilemap where they should go.

2 Likes

To be honest with you, just now I was just trying to say that as well I just was thinking about explaining what blocks he should delete instead of just saying that, but anyways thank you for replying to correct what I was trying to say I appreciate it.

1 Like