[HELP] How to obtain the forward ground height? using forward vector?

I have the forward vector x and y, but I am having trouble spawning the objects at ground level… They always are too high or too low I am trying to guesstimate it using player pos and adding / subtracting some numbers =/

local frontx = GetEntityForwardX(player)
local fronty = GetEntityForwardY(player)

local _, gZ = GetGroundZFor_3dCoord(x, y, z)

gZ is the ground height

so basically, after I spawn the object, I use getGroundZ then I just move the object to the same x,y but adding gZ as z right?

Well, you need the coordinate before you spawn the object anyway, right? So put the coordinates into that native and just substitute the z for gZ

1 Like

GetGroundZFor_3dCoord return boolean value.

It returns two values, the first of which is a boolean.