-
Notifications
You must be signed in to change notification settings - Fork 201
Closed
Description
Quite a few things are now known about this issue:
- The oldest engine I tested this also had the bug, it was in engine 1486.
- When a building is built by a constructor, the edges of the flattened area randomly miss on TraceScreenRay
- If the buildings are /give-en, then the bug is not present
- If the terrain is restored underneath /given buildings, the bug becomes visible.
- Explosions and craters do not show this behaviour
- The issue can relatively easily be checked by this widget that traces the screen along a regular grid, and draws a red rectangle if the trace fails.
function widget:GetInfo()
return {
name = "ScreenTrace",
desc = "Trace the screen along a regular grid, drawing a red rectangle on any ray that does not hit the ground",
author = "beheriht",
date = "2021 summer heat",
license = "Bacon",
layer = 10000,
enabled = true -- loaded by default?
}
end
local resolution = 10
local vsx, vsy
function widget:ViewResize(newX,newY)
vsx, vsy = Spring.GetViewGeometry()
end
function widget:Initialize()
widget:ViewResize()
end
function widget:DrawScreen()
gl.Color(1.0, 0.0, 0.0, 0.75) --red
for x = 1, vsx, resolution do
for y = 1, vsy, resolution do
local _ , coords = Spring.TraceScreenRay(x, y, true)
if coords and coords[2] and coords[2] > -1000 then
--gl.Color(0.0, 1.0, 0.0, 0.5) -- green
--gl.Rect(x, y, x+ resolution/2, y+resolution/2) -- x y w h
else
--gl.Color(1.0, 0.0, 0.0, 0.75) --red
gl.Rect(x, y, x+ resolution, y+ resolution) -- x y w h
end
end
end
end
Metadata
Metadata
Assignees
Labels
No labels