IsPointInsidePolygon

From The Official Visionaire Studio: Adventure Game Engine Wiki
Revision as of 21:41, 30 April 2015 by Vis apiuser (talk) (Created page with "==isPointInsidePolygon== <div class="command-min-version-info">Available since: <span class="command-min-version">v4.2</span></div> <div class="command-doc">Tests if a point...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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)