GetWaterVertexPosition: Difference between revisions
Jump to navigation
Jump to search
(Added oop syntax) |
Zangomangu (talk | contribs) m (Has example) |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server client function}} | {{Server client function}} | ||
Gets the world position of a vertex (i.e. corner) of a [[water]] area. Each water area is either a triangle or quad (rectangle) so each has 3 or 4 corners. | Gets the world position of a vertex (i.e. corner) of a [[water]] area. Each water area is either a triangle or quad (rectangle) so each has 3 or 4 corners. | ||
Line 8: | Line 6: | ||
<syntaxhighlight lang="lua">int int float getWaterVertexPosition ( water theWater, int vertexIndex )</syntaxhighlight> | <syntaxhighlight lang="lua">int int float getWaterVertexPosition ( water theWater, int vertexIndex )</syntaxhighlight> | ||
{{OOP||[[water]]:getVertexPosition| | {{OOP||[[water]]:getVertexPosition||setWaterVertexPosition}} | ||
===Required Arguments=== | ===Required Arguments=== | ||
Line 19: | Line 17: | ||
==Example== | ==Example== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- | function water() | ||
local water = createWater(1866, -1444, 10, 1968, -1442, 10, 1866, -1372, 10, 1968, -1370, 10); -- create water element | |||
local x, y, z = getWaterVertexPosition(water, 1); -- get first vertex position of our water element | |||
outputChatBox("Water first vertex position X: "..x.." Y: "..y.." Z: "..z); | |||
end | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Water functions}} | {{Water functions}} |
Latest revision as of 17:10, 2 January 2022
Gets the world position of a vertex (i.e. corner) of a water area. Each water area is either a triangle or quad (rectangle) so each has 3 or 4 corners.
Syntax
int int float getWaterVertexPosition ( water theWater, int vertexIndex )
OOP Syntax Help! I don't understand this!
- Method: water:getVertexPosition(...)
- Counterpart: setWaterVertexPosition
Required Arguments
- theWater: the water element to get the vertex of
- vertexIndex: the index of the vertex whose position to get. Values range from 1 to 4 for a water quad, or 1 to 3 for a triangle.
Returns
Returns the x, y and z coordinates of the specified vertex if successful, false otherwise.
Example
function water() local water = createWater(1866, -1444, 10, 1968, -1442, 10, 1866, -1372, 10, 1968, -1370, 10); -- create water element local x, y, z = getWaterVertexPosition(water, 1); -- get first vertex position of our water element outputChatBox("Water first vertex position X: "..x.." Y: "..y.." Z: "..z); end
See Also
- createWater
- getWaterColor
- getWaterVertexPosition
- getWaveHeight
- resetWaterColor
- resetWaterLevel
- setWaterColor
- setWaterLevel
- setWaterVertexPosition
- setWaveHeight