SetColPolygonHeight: Difference between revisions
Jump to navigation
Jump to search
CrosRoad95 (talk | contribs) (Created page with "{{Server client function}} __NOTOC__ {{New feature/item|3.0158|1.5.7|20397|This function is used to change height of an existing colshape polygon.}} ==Sy...") |
mNo edit summary |
||
(5 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
{{Server client function}} | {{Server client function}} | ||
__NOTOC__ | __NOTOC__ | ||
{{New feature/item|3. | {{New feature/item|3.0159|1.5.8|20807|This function is used to change the height of an existing [[createColPolygon|colshape polygon]]. | ||
By default, a colshape polygon is infinitely tall.}} | |||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
bool setColPolygonHeight( colshape shape, float | bool setColPolygonHeight( colshape shape, float floor, float ceil ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[colshape]]:setHeight|}} | {{OOP||[[colshape]]:setHeight|}} | ||
Line 11: | Line 12: | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''shape:''' The [[colshape]] polygon | *'''shape:''' The [[colshape]] polygon | ||
*''' | *'''floor:''' The polygon floor (lowest Z coordinate). Parse ''false'' to reset this value to 0. | ||
*''' | *'''ceil:''' The polygon ceiling (highest Z coordinate). Parse ''false'' to reset this value to infinitely tall. | ||
===Returns=== | ===Returns=== | ||
Line 18: | Line 19: | ||
==Example== | ==Example== | ||
This example sets every polygon colshape's max heigh to 50 units once resource starts. | |||
<section name="Server side script" class="server" show="true"> | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function setPolygonsHeight() | |||
for i, v in ipairs(getElementsByType("colshape")) do | |||
if (getColShapeType(v) == 4) then -- if it's a polygon colshape do it otherwise don't | |||
setColPolygonHeight(v, false, 50) | |||
end | |||
end | |||
end | |||
addEventHandler("onResourceStart", resourceRoot, setPolygonsHeight) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | |||
==Requirements== | ==Requirements== | ||
{{Requirements|1.5. | {{Requirements|1.5.8-9.20807|1.5.8-9.20807|}} | ||
==See Also== | ==See Also== | ||
{{Collision_shape_functions}} | {{Collision_shape_functions}} |
Revision as of 11:31, 11 April 2021
This function is used to change the height of an existing colshape polygon. By default, a colshape polygon is infinitely tall.
Syntax
bool setColPolygonHeight( colshape shape, float floor, float ceil )
OOP Syntax Help! I don't understand this!
- Method: colshape:setHeight(...)
Required Arguments
- shape: The colshape polygon
- floor: The polygon floor (lowest Z coordinate). Parse false to reset this value to 0.
- ceil: The polygon ceiling (highest Z coordinate). Parse false to reset this value to infinitely tall.
Returns
Returns true if the polygon was changed, false if invalid arguments were passed.
Example
This example sets every polygon colshape's max heigh to 50 units once resource starts.
Click to collapse [-]
Server side scriptfunction setPolygonsHeight() for i, v in ipairs(getElementsByType("colshape")) do if (getColShapeType(v) == 4) then -- if it's a polygon colshape do it otherwise don't setColPolygonHeight(v, false, 50) end end end addEventHandler("onResourceStart", resourceRoot, setPolygonsHeight)
Requirements
Minimum server version | 1.5.8-9.20807 |
---|---|
Minimum client version | 1.5.8-9.20807 |
Note: Using this feature requires the resource to have the above minimum version declared in the meta.xml <min_mta_version> section. e.g. <min_mta_version server="1.5.8-9.20807" client="1.5.8-9.20807" />
See Also
- addColPolygonPoint
- createColCircle
- createColCuboid
- createColPolygon
- createColRectangle
- createColSphere
- createColTube
- getColPolygonHeight
- getColPolygonPoints
- getColPolygonPointPosition
- getColShapeType
- getColShapeRadius
- getColShapeSize
- getElementColShape
- getElementsWithinColShape
- isElementWithinColShape
- isInsideColShape
- removeColPolygonPoint
- setColPolygonHeight
- setColPolygonPointPosition
- setColShapeRadius
- setColShapeSize