Is there any way to retrieve the location of a specific node (relative to the map origin)? For, say, use in a UI app.
You can get the entire vehicle position with obj:getPosition(). But there is no way to get the node position from the physics. (as far as I know) You can get the node position in the JBeam but it will not correspond to it's position in the world Code: for k,v in pairs(v.data.nodes) do print("pos: " .. v.x .. " " .. v.y .. " " .. v.z) end EDIT: 5 years later we can now do this. I forget whether the function is called obj:getNodePos or obj:getNodePosition. The input is the node cid (not the name)
Thanks for the info on this @Dummiesman. I tried what you posted in your update and I'm afraid that you still can't directly get a location for a node relative to the map origin, even using getNodePosition(). As far as I can tell, that's not a big problem though. I've just been adding the (relative) node position to the (absolute) vehicle position. Convert both to vec3 and just do an addition operation. Signing (negative/positive) gets handled automatically. This seems to be an OK technique. I'd be interested to hear about it if I'm doing something bad though! Code: local searchNodeName = "fw1l" local searchNodePos for k,v in pairs(v.data.nodes) do if v.name == searchNodeName then searchNodePos = vec3(obj:getPosition()) + vec3(obj:getNodePosition(v.cid)) end end dump(searchNodePos)
getNodePosition gets the node position relative to the vehicles location, so that would be the correct way to get it in world space