Difference between revisions of "IsPointInsidePolygon"

From The Official Visionaire Studio: Adventure Game Engine Wiki
(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...")
 
 
Line 1: Line 1:
−
==isPointInsidePolygon==
+
#REDIRECT [[Global Command: 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 is inside polygon.</div>
 
−
 
 
−
Lua Syntax:
 
−
<pre class="command-syntax">isPointInsidePolygon(point, polygon)</pre>
 
−
===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
 
−
<syntaxhighlight>
 
−
local anim = ActiveAnimations['Cloud']
 
−
local polygon = game.GameCurrentScene.SceneObjects['Window'].ObjectPolygon
 
−
cloudVisible = isPointInsidePolygon(anim.AnimationCurrentPosition, polygon)
 
−
</syntaxhighlight>
 

Latest revision as of 13:28, 19 May 2023