• Making a trace to find the ground's Z
    2 replies, posted
I'm trying to use a trace to find the Z of the ground below a certain prop, but whenever i make the trace outside of the world it makes my game crash. heres the code im using [code] local tracedata = {} tracedata.start = pos tracedata.endpos = pos+Vector(0,0,-100000) local trace = util.TraceLine(tracedata) local Z = trace.HitPos.z [/code] all i need to do is get the Z of the ground below a prop
Just don't start the trace outside of the world? [lua]if util.IsInWorld(pos) then -- do your tracing[/lua]
[QUOTE=Entoros;23171011]Just don't start the trace outside of the world?[/quote] the start is in the world, but i need the end to be outside of the world so i can find the height of the ground. whenever i make the endpos outside of the world it crashes my game. how else can i get the height of the ground below a prop?
Sorry, you need to Log In to post a reply to this thread.