Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Bentzung: local objektid, weltposx, weltposy, weltposz, objektrotx, objektroty, objektrotz = getPlayerNearestBaum(thePlayer)
- local function getPlayerNearestBaum(thePlayer)
- local x, y, z = getElementPosition(thePlayer)
- for i = 1, 360, 1 do -- Wenn es laggt, die zweite 1 auf 5 setzen
- local x2, y2 = getPointFromDistanceRotation(x, y, 2.5, i)
- if(x2) and (y2) then
- local hit, _, _, _, _, _, _, _, material, licht, _, objektid, wx, wy, wz, wrx, wry, wrz, objektlod = processLineOfSight(x, y, z, x2, y2, z, true, false, false, true, false, false, false, false, nil, true)
- if(hit) and (objektid) then
- return objektid, wx, wy, wz, wrx, wry, wrz;
- end
- end
- end
- end
- function getPointFromDistanceRotation(x, y, dist, angle)
- local a = math.rad(90 - angle);
- local dx = math.cos(a) * dist;
- local dy = math.sin(a) * dist;
- return x+dx, y+dy;
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement