How to get HitBlockCoords from FirstSolidHitTrace
#2
Hello, welcome to the forum.

You shouldn't look at the C++ code for Lua code parameters, they sometimes do differ, especially when the C++ code uses references as out-params - Lua can return multiple return values, so the API is reflecting that. Have a look at the API docs: https://api.cuberite.org/cLineBlockTracer.html

The function FirstSolidHitTrace() takes only 3 parameters, and returns 4 values, so the proper way to use it is:
local hasHit, hitCoords, hitBlockCoords, hitBlockFace = cLineBlockTracer:FirstSolidHitTrace(World, Start, End)
-- hasHit is a boolean
-- hitCoords is a Vector3d
-- hitBlockCoords is a Vector3i
-- hitBlockFace is an eBlockFace
LOGD("Looking at block {" .. hitBlockCoord.x .. ", " .. hitBlockCoord.y .. ", " .. hitBlockCoord.z .. "}")
Reply
Thanks given by:


Messages In This Thread
RE: How to get HitBlockCoords from FirstSolidHitTrace - by xoft - 09-01-2019, 07:05 AM



Users browsing this thread: 1 Guest(s)