guides:compute-water-elevation
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
guides:compute-water-elevation [2020/04/22 12:45] – vjraymon | guides:compute-water-elevation [2021/02/23 11:52] (current) – wording edit minotorious | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Custom | + | ====== Custom |
- | + | ||
- | + | ||
- | Since 1.5, Foundation allows to mod Custom component and links it to a fbx (see Exemple02) | + | |
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: | ||
- | + | <code lua> | |
function MY_CUSTOM_COMPONENT: | function MY_CUSTOM_COMPONENT: | ||
local raycastResult = {} | local raycastResult = {} | ||
Line 27: | Line 24: | ||
end | end | ||
end | end | ||
+ | </ | ||
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 | + | If water (or 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. | ||
+ | |||
+ | Note: Water doesn' | ||
guides/compute-water-elevation.1587573906.txt.gz · Last modified: 2020/04/22 12:45 by vjraymon