30 Nov 2023 |
wazabear | e.g. you can freely spawn meshes in the world and control their scale, position, etc... for a spark effect or blood splatter | 23:37:55 |
wazabear | or get a reference to the players base node and attach a mesh to a bone | 23:38:18 |
maxyari | thats pre cool, what about read-only browsing of nodes atleast? I imagine this can be very usefull | 23:38:44 |
maxyari | even if parenting is only to named nodes, one can just manually parent to anything if one can read nodes position every frame | 23:39:08 |
wazabear | I want it but there is too much pushback. I don't want to write essays and argue, it's not something I enjoy. | 23:39:29 |
maxyari | yea, haha, I can feel that | 23:39:55 |
wazabear | This will be a good stepping stone at least, and doesn't shoehorn the API into any corners. | 23:40:12 |
maxyari | dont enjoy it either | 23:40:12 |
maxyari | well, sounds quite exciting honestly | 23:40:43 |
maxyari | attaching things to bones sounds pretty handy especially | 23:41:41 |
1 Dec 2023 |
johnnyhostile | I seem to be consistently getting points in the water when I do this:
nearby.findRandomPointAroundCircle(position, radius, {includeFlags = nearby.NAVIGATOR_FLAGS.Walk})
nearby.findNearestNavMeshPosition() does it too. Am I doing something wrong? | 00:02:48 |
zackhasacat | Deep or shallow water? | 00:17:16 |
johnnyhostile | Both; for example when I choose points in Seyda Neen I'll always get some in the shallows but every now and then I'll get one in the deep by the silt strider. Vivec City I'd say the majority of points I get are in the water. | 00:18:00 |
e1sid |  Download screenshot285.png | 01:27:09 |
e1sid | I made a mod which spawns pillows at coordinates generated by findRandomPointAroundCircle and it seems to work as expected:
global.lua
local world = require('openmw.world')
local function onFindRandomPointAroundCircle(position)
pillow = world.createObject('misc_uni_pillow_01', 1)
pillow:teleport('', position)
end
return {
eventHandlers = {
findRandomPointAroundCircle = onFindRandomPointAroundCircle,
},
}
player.lua
local core = require('openmw.core')
local nearby = require('openmw.nearby')
local self = require('openmw.self')
local function onUpdate()
local radius = 4096
local options = {includeFlags = nearby.NAVIGATOR_FLAGS.Walk}
local position = nearby.findNearestNavMeshPosition(self.position, options)
local result = nearby.findRandomPointAroundCircle(position, radius, options)
core.sendGlobalEvent('findRandomPointAroundCircle', result)
end
return {
engineHandlers = {
onUpdate = onUpdate,
},
} | 01:27:14 |
e1sid | The thing is navmesh covers a surface so underwater ground has one. There is a small strip at the shore where there is none. | 01:29:32 |
e1sid | Probably we could define underwater ground and above the water as different type of areas. | 01:30:28 |
e1sid | Still there is always small part of the shallow water covered by Walk navmesh area. | 01:31:19 |
zackhasacat | You could just keep going until you get a point above 0 zpos | 01:31:36 |
zackhasacat | Or if there was a function to get the cell water level | 01:31:45 |
e1sid |  Download screenshot286.png | 01:38:41 |
e1sid | There might be a problem with this. findNearestNavMeshPosition selects a point on the nearest navmesh but findRandomPointAroundCircle chooses one only on the same component (https://en.wikipedia.org/wiki/Component_(graph_theory)). For example if I stay too close to a house roof, I start to get pillows only there. The same is with underwater/above water since those are different navmesh components. | 01:38:44 |
zackhasacat | Yes, you wouldn't wan to try again forever | 01:39:17 |
zackhasacat | Sadly, navmesh is also generated underneath buildings | 01:39:51 |
zackhasacat | sometimes at least | 01:39:55 |
zackhasacat | so you can''t just pick a random huge area. You might also want to check if you can path to it | 01:40:10 |
e1sid | Yeah, it would be nice to have some heuristics to avoid generating navmesh for some of the surfaces. | 01:42:30 |
johnnyhostile | Thank you, I think this was the key to understanding what I was doing wrong. I thought I could use 0 for z when calculating a cell's center, then find the point from there but this explains why I got underwater points in Vivec City. Now when I use the player's z I get much more sensible points. | 02:09:11 |
johnnyhostile | .. I do seem to still get deep underwater points but I think I can weed those results out. | 02:18:12 |
| zackhasacat changed their profile picture. | 20:51:20 |