IsPointInsidePolygon
From The Official Visionaire Studio: Adventure Game Engine Wiki
Contents
isPointInsidePolygon
Available since: v4.2
Tests if a point is inside polygon.
Lua Syntax:
isPointInsidePolygon(point, polygon)
Arguments
point
- {x=int,y=int} -
polygon
- {{x=int,y=int},...} - A single polygon. Bear in mind that a field containing multiple polygons (e.g. a way border or object polygon) must first be split into single polygons and tested separately.
Flags
Return Values
None.
Examples
Example 1: Test if the current position of an active 'cloud' animation is inside the polygon of a 'window' object on the current scene and store the result in a global variable
local anim = ActiveAnimations['Cloud']
local polygon = game.GameCurrentScene.SceneObjects['Window'].ObjectPolygon
cloudVisible = isPointInsidePolygon(anim.AnimationCurrentPosition, polygon)