-
Member
[Help] Underwater or underground objects
hi, can anyone help?
How to find out,
whether the object is underwater or underground,
such as ore or grass
Last edited by Hrap; 02-01-2023 at 06:28 AM.
-
Established Member
check pos.z with liquid height it means above or under water.
-
Post Thanks / Like - 1 Thanks
Hrap (1 members gave Thanks to oiramario for this useful post)
-
Depending on your meshes you can also check the flag of the nearest poly around the nodes vector.
-
Post Thanks / Like - 1 Thanks
Hrap (1 members gave Thanks to MrFade for this useful post)
-
For nodes specifically you can infer some characteristics from a traceline query. This is not *entirely* accurate -- there are some edge cases -- but it is the simplest option. If you need higher precision you will need to do a sphere intersection with the map geometry.
Run a terrain/wmo traceline from [node.x, node.y, node.z + node.iteractDistance] to [node.x, node.y, node.z - node.interactDistance]:
1. No hit means the node is "floating" and is probably invalid (this should rarely happen: edge case; or ostensibly spawned in a broken position underground or something.)
2. WMO hit means it is attached to a building or cave.
3. Terrain hit means it is above ground.
To check if a node (or any position) is underwater, there is a better option to consider using over traceline - it is possible that there are liquid chunks above the node without the node necessarily being underwater.
Code:
delegate bool World::QueryLiquid(nint world, in Vector3 position, out int liquid, out float surface);
// Usage:
var world = World::GetActiveScene();
var underwater = World::QueryLiquid(world, node.Position, out var liquidId, out var surface);
-
Post Thanks / Like - 1 Thanks
Hrap (1 members gave Thanks to Jadd for this useful post)
-
Member
Heh... Thanks a lot for help
This turned out to be a very difficult task for my.
I don't know yet how to start tracing lines.
All I have is the position of the player and the node.
I understand that I need to check if there are polygons between the player and the node.
But how and where to read these polygons, I don’t know
Last edited by Hrap; 02-06-2023 at 07:52 PM.
-
Established Member
const uint32_t WorldIntersect = 0x7A3B70;
Search the forum for how to use it.
for liquid you must read acore code.
-
Post Thanks / Like - 1 Thanks
Hrap (1 members gave Thanks to oiramario for this useful post)