RayCasting |
vastrolorde
|
I found the previous error i had. i had set the line segments bit wrong. But the new problem i ran into is that when i added more objects to the playfield, some corners went wrong. Each point is processed with small deviation in angle on both sides to hit the walls behind. But when added more objects the orded of witch it draw the polygon lines gets mixed up and some random point appear that shouldnt be there.
|
|||||||||||||
|
vastrolorde
|
Image of raycast gone wrong. Redboxes are static and blue is the one i move.
|
|||||||||||
|
vastrolorde
|
FIxed it. Problem was that i calculate an angle and get 2 offsets from it. But when i save the closes tpoint to array i use only the calculated angle not the offset, so the sorting alroithm doesent gonow whits order they should be. So i now save the ofsetted angles also and it works.
|
|||||||||||
|