forked from Simnation/Main
e
This commit is contained in:
parent
de946967d7
commit
7ecdc5330d
1 changed files with 34 additions and 24 deletions
|
@ -131,11 +131,21 @@ local function toggleAnchor(vehicle)
|
|||
-- Finde die Wasseroberfläche unter dem Boot
|
||||
local waterHeight = GetWaterHeightNoWaves(coords.x, coords.y, coords.z)
|
||||
|
||||
-- Wenn Wasser gefunden wurde, setze das Boot auf die Wasseroberfläche
|
||||
if waterHeight ~= 0 then
|
||||
-- Wenn kein Wasser gefunden wurde, nutze eine alternative Methode
|
||||
if waterHeight == 0 then
|
||||
-- Versuche mit TestVerticalProbeAgainstAllWater
|
||||
local success, height = TestVerticalProbeAgainstAllWater(coords.x, coords.y, coords.z, 0, coords.z - 10.0)
|
||||
if success then
|
||||
waterHeight = height
|
||||
else
|
||||
-- Fallback: Setze Boot leicht unter aktuelle Position
|
||||
waterHeight = coords.z - 0.5
|
||||
end
|
||||
end
|
||||
|
||||
-- Setze das Boot auf die Wasseroberfläche mit leichtem Offset
|
||||
SetEntityCoords(vehicle, coords.x, coords.y, waterHeight)
|
||||
coords = GetEntityCoords(vehicle) -- Aktualisiere Koordinaten nach Positionsänderung
|
||||
end
|
||||
|
||||
FreezeEntityPosition(vehicle, true)
|
||||
SetEntityInvincible(vehicle, true)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue