Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Ray casting problem
- drmcw
-
1000+ posts
Ray casting problem
I decided to use a maze creator project I had in a ray casting program. The project can be found here.
The project notes give the url of the ray casting algorithm I used and am starting to regret using now. If you run the program you'll be dumped into a random maze and will probably see some problems. To help debug though; in the raycast sprite there are stack of blocks that delete the maze list and recreate a simple 10x10 room with a central column. If you snap that into the start of the “when I receive maze complete” block, it should make things easier to see.
If you look in the corners and around the central column you'll find that you can see “through” the corners from some angles or they don't align properly.
I think the problem is in the DDA script but cannot work out what it is.
The project notes give the url of the ray casting algorithm I used and am starting to regret using now. If you run the program you'll be dumped into a random maze and will probably see some problems. To help debug though; in the raycast sprite there are stack of blocks that delete the maze list and recreate a simple 10x10 room with a central column. If you snap that into the start of the “when I receive maze complete” block, it should make things easier to see.
If you look in the corners and around the central column you'll find that you can see “through” the corners from some angles or they don't align properly.
I think the problem is in the DDA script but cannot work out what it is.
- sindrijo
-
7 posts
Ray casting problem
It looks like both sides of a wall cannot be drawn.
It also looks like the rotation snaps around 180/-180 or something.
It does look like you are not detecting the edges, which is one of the first problems talked about in the documentation
I did however not find any errors in the script at first glance, it does look like it has been correctly converted to Scratch.
It also looks like the rotation snaps around 180/-180 or something.
It does look like you are not detecting the edges, which is one of the first problems talked about in the documentation
I did however not find any errors in the script at first glance, it does look like it has been correctly converted to Scratch.
- drmcw
-
1000+ posts
Ray casting problem
It looks like both sides of a wall cannot be drawn.
It also looks like the rotation snaps around 180/-180 or something.
It does look like you are not detecting the edges, which is one of the first problems talked about in the documentation
I did however not find any errors in the script at first glance, it does look like it has been correctly converted to Scratch.
Thanks for the input. Was wondering whether I couldn't see the wood for the trees and had made a silly error, but starting to think I'll have to check the algorithm itself.
- drmcw
-
1000+ posts
Ray casting problem
Can't see anything wrong with the algorithm and have just ported it to C# where it works, so there must be a bug in the Scratch port.
- Discussion Forums
- » Help with Scripts
-
» Ray casting problem