guides:compute-water-elevation
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
guides:compute-water-elevation [2020/04/22 12:48] – vjraymon | guides:compute-water-elevation [2020/04/23 18:39] – vjraymon | ||
---|---|---|---|
Line 6: | Line 6: | ||
The following LUA code computes and returns the global Y elevation of water from a global position: | The following LUA code computes and returns the global Y elevation of water from a global position: | ||
- | < | + | < |
function MY_CUSTOM_COMPONENT: | function MY_CUSTOM_COMPONENT: | ||
local raycastResult = {} | local raycastResult = {} | ||
Line 31: | Line 31: | ||
You can do the same with the ground by replacing OBJECT_FLAG.WATER by OBJECT_FLAG.GROUND | You can do the same with the ground by replacing OBJECT_FLAG.WATER by OBJECT_FLAG.GROUND | ||
- | If the water (or the ground) is not found (for instance when the _globalPosition out of the map) then a warning is edited in the logs, and the code return | + | If the water (or the ground) is not found (for instance when the '' |
+ | |||
+ | This can be used, for instance, when moving an object on the ground or water whatever the slope (the water HAVEN' | ||
guides/compute-water-elevation.txt · Last modified: 2021/02/23 11:52 by minotorious