Skip to content

editor: Fix for misaligned bounding box #638

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions [editor]/editor_main/client/gridlines.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,22 @@ local function renderGridlines()
local camX,camY,camZ = getCameraMatrix()
--Work out our line thickness
local thickness = (100/getDistanceBetweenPoints3D(camX,camY,camZ,x,y,z)) * MAX_THICKNESS

--Apply the adjustment for non-centered bounding box according to c++ implementaion
--https://github.com/multitheftauto/mtasa-blue/blob/88d303c0bbcc0ed4fee958df2d16ace562ce0108/Client/mods/deathmatch/logic/CClientStreamElement.cpp#L224

local halfCenterX = (minX + maxX) * 0.25
local halfCenterY = (minY + maxY) * 0.25
local halfCenterZ = (minZ + maxZ) * 0.25

--subtracting half center
minX = minX - halfCenterX
minY = minY - halfCenterY
minZ = minZ - halfCenterZ
maxX = maxX - halfCenterX
maxY = maxY - halfCenterY
maxZ = maxZ - halfCenterZ

--
local elementMatrix = (getElementMatrix(attachedToElement) and not ignoreMatrix[getElementType(attachedToElement)])
and matrix(getElementMatrix(attachedToElement))
Expand Down
Loading