Hundreds of features to explore
Games made in Construct
Your questions answered
Trusted by schools and universities worldwide
Free education resources to use in the classroom
Students do not need accounts with us
What we believe
We are in this together
World class complete documentation
Official and community submitted guides
Learn and share with other game developers
Upload and play games from the Construct community
Game development stories & opinions
I have an enemy that uses line of sight that can't detect objects when next to walls, so I wanted some info on how the behavior works so I can fix this.
LOS "draws" a straight line between origin points of both objects, and checks if this line is crossing any obstacles. So the form and size of objects don't matter, only the position of their origin points.
How many pixels thick is the line and from where on the object does it start drawing the line?
Develop games in your browser. Powerful, performant & highly capable.
I don't know how it's actually made, but think of a 1 px wide line that starts at object1 origin point and ends at object2 origin point. Even if there is a very small obstacle blocking this line, the LOS will be considered blocked.
I think you're right. I displaced my line fo sight characters by so many pixels and then put them back after the line fo sight check and it seems to have fixed it because my origin points can't be centered.