Construct 2 has been officially retired. Now you should upgrade to Construct 3.
Line-of-sight
The Line-of-sight (LOS) behavior allows the ability to check if two objects can "see" each other. More precisely, it will check if there are any obstacles blocking a line between the two objects.
For an example of the Line-of-sight behavior, see the Line-of-sight example in the Start dialog.
Line-of-sight properties
- Obstacles
- Whether to use Solids as blocking line-of-sight, or Custom, where the objects blocking line-of-sight must be added using the Add obstacle action.
- Range
- The maximum distance in pixels that line-of-sight can reach. If an object is further away than this distance, the object will never have line-of-sight to it, even if the intervening space is clear.
- Cone of view
- The angle of the cone of view in which the object can have line-of-sight to other objects, relative to the current angle of the object. For example if this is 180, then the object can have line-of-sight to any objects anywhere in front of it, but never behind it. If 360, the object can have line-of-sight to objects at any angle.
- Use collision cells
- Whether to use the collision cells optimisation when testing line of sight. Usually this is faster, but in some cases over extremely long distances it can be slower. #Line-of-sight conditions#
- Has LOS to object
- Check if the object currently has line-of-sight to another object. For the condition to be true, the object must be within range, within the cone of view, and with no obstacles in the way of a straight line between the two objects. This condition also picks the instances of the chosen object that are in the line of sight.
- Has LOS to position
- Check if the object currently has line-of-sight to a position in the layout. For the condition to be true, the object must be within range, within the cone of view, and with no obstacles in the way of a straight line between the two objects.
Line-of-sight actions
- Add obstacle
- If the Obstacles property is Custom, adds an object type to count as an obstruction to line-of-sight.
- Clear obstacles
- If the Obstacles property is Custom, clears any object types added as obstacles with the Add obstacle action.
- Set cone of view
- Set range
- Sets the corresponding behavior properties. For more information, see Line-of-sight properties.
Line-of-sight expressions
- ConeOfView
- Range
- Retrieve the corresponding behavior properties. For more information, see Line-of-sight properties.
Construct 2 Manual
Construct.net
2020-06-08
2020-06-09
You are here:
Search this manual:
This manual entry was last updated on 9 Jun, 2020 at 12:56