Skip to content
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

[BUG] Snapped rails are slightly misplaced #31

Closed
dvdvideo1234 opened this issue Aug 20, 2021 · 3 comments · Fixed by #32
Closed

[BUG] Snapped rails are slightly misplaced #31

dvdvideo1234 opened this issue Aug 20, 2021 · 3 comments · Fixed by #32
Assignees
Labels

Comments

@dvdvideo1234
Copy link
Owner

dvdvideo1234 commented Aug 20, 2021

Describe the bug
Sometimes in certain cases, if the user tries to snap a track to already rotated and frozen track, a slight misplacement of the joint may be experienced leading to derailment and misplaced attachments. THIS IS NOT RELATED TO FLOAT MISPLACEMENTS

To Reproduce
Steps to reproduce the behavior:

  1. Load gm_construct
  2. Normal spawn PHX x16 track as points 1>2 to be water>wall
  3. Snap 16x PHX track to point 1 of the spawned track

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
How is it ghosted:
20210820162355_1
How it spawns:
20210820162403_1

Host machine (please complete the following information):

  • OS type: Win
  • OS version: Win7 SP1
  • Gmod platform: PC
  • Gmod branch: x64
  • Gmod version: 2021.08.09
  • Gmod instance: BOTH
  • Tool version: 8.661

Additional context
base-DB: stSpawn.BPos, stSpawn.BAng ( Trace piece database entry )
trac-EN: stSpawn.TOrg, stSpawn.TAng ( trace entity positio/angle )
base-CA: stSpawn.BPos, stSpawn.BAng ( Values after calling ENT:LocalToWorld )
hold: stSpawn.HPnt, stSpawn.HOrg, stSpawn.HAng ( Holder piece database entry )
orgn: stSpawn.OPos, stSpawn.OAng ( Origin/angin angle for matrix manipulations )
spawn: stSpawn.SPos, stSpawn.SAng ( Calculated spawn position and angle )

trigger
base-DB:	2029.797363 0.000133 12.548828	0.000 0.000 0.000
trac-EN:	-19.115608 -2153.927002 -147.223434	0.000 90.000 0.000
base-CA:	-19.115435 -124.129639 -134.674606	-0.000 90.000 0.000
hold:	-370.036865 -0.000000 12.548828	-370.036865 -0.000000 12.548828	0.000 -180.000 0.000
orgn:	-19.115435 -124.129639 -134.674606	-0.000 90.000 0.000
spawn:	-19.115379 245.907257 -147.223434	-0.000 90.000 0.000
1:	-19.115379 245.907257 -147.223434	-0.000 90.000 0.000
2:	-19.115379 245.907257 -147.223434	-0.000 90.000 0.000
base-DB:	2029.797363 0.000133 12.548828	0.000 0.000 0.000
trac-EN:	-19.115608 -2153.927002 -147.223434	0.000 89.995 0.000
base-CA:	-18.920891 -124.129639 -134.674606	-0.000 89.994 0.000
hold:	-370.036865 -0.000000 12.548828	-370.036865 -0.000000 12.548828	0.000 -180.000 0.000
orgn:	-18.920891 -124.129639 -134.674606	-0.000 89.994 0.000
spawn:	-18.885368 245.907227 -147.223434	-0.000 89.994 0.000
base-DB:	2029.797363 0.000133 12.548828	0.000 0.000 0.000
trac-EN:	-19.115608 -2153.927002 -147.223434	0.000 89.995 0.000
base-CA:	-18.920891 -124.129639 -134.674606	-0.000 89.994 0.000
hold:	-370.036865 -0.000000 12.548828	-370.036865 -0.000000 12.548828	0.000 -180.000 0.000
orgn:	-18.920891 -124.129639 -134.674606	-0.000 89.994 0.000
spawn:	-18.885368 245.907227 -147.223434	-0.000 89.994 0.000
base-DB:	2029.797363 0.000133 12.548828	0.000 0.000 0.000
trac-EN:	-19.115608 -2153.927002 -147.223434	0.000 89.995 0.000
base-CA:	-18.920891 -124.129639 -134.674606	-0.000 89.994 0.000
hold:	-370.036865 -0.000000 12.548828	-370.036865 -0.000000 12.548828	0.000 -180.000 0.000
orgn:	-18.920891 -124.129639 -134.674606	-0.000 89.994 0.000
spawn:	-18.885368 245.907227 -147.223434	-0.000 89.994 0.000
3:	-18.885368 245.907227 -147.223434	-0.000 89.994 0.000
@dvdvideo1234 dvdvideo1234 self-assigned this Aug 20, 2021
@dvdvideo1234
Copy link
Owner Author

In the rotator tool copy angle is retrieved from the server into the convars as 89.994 instead of 90.0. Consider the following case where the angle test is a local variable and stSpawn.TAng uses the assignment Set method:

        stSpawn.TOrg:Set(trEnt:GetPos())
        stSpawn.TAng:Set(trEnt:GetAngles()); --SnapAngle(stSpawn.TAng, 15)
        SetVector(stSpawn.TPnt, trPOA.P)
        stSpawn.TPnt:Rotate(stSpawn.TAng)
        stSpawn.TPnt:Add(stSpawn.TOrg)
  -- Found the active point ID on trEnt. Initialize origins
  SetVector(stSpawn.BPos, trPOA.O) -- Read origin
  SetAngle (stSpawn.BAng, trPOA.A) -- Read angle
  if(trEnt:GetNetworkedBool("trackassembly_debugen")) then
    print("base-DB:", stSpawn.BPos, stSpawn.BAng)
    print("trac-EN:", stSpawn.TOrg, stSpawn.TAng)
    local test = trEnt:GetAngles()
    print("SP-hash", test.p, test.y, test.r)
    print("SP-intg", test[1], test[2], test[3])
  end

trac-EN:    922.957764 702.231873 -31.192244    0.000 90.000 0.000
SP-hash    0    89.999984741211    0
SP-intg    0    89.999984741211    0

@dvdvideo1234
Copy link
Owner Author

There has to be spawn angles correction for the first ( hit-normal ) track after the matrix manipulation:

trigger
1:from	0.000 -90.000 0.000
1:from	0	-90	0
1:from	0	-90	0
1:uang	0.000 -90.000 0.000
1:uang	0	-90	0
1:uang	0	-90	0
1:bang	0.000 -90.000 0.000
1:bang	0	-90	0
1:bang	0	-90	0
1:origin	0.000 -90.000 0.000
1:origin	0	-90	0
1:origin	0	-90	0
2:origin	0.000 -90.000 0.000
2:origin	0	-90	0
2:origin	0	-90	0
hold:	-370.037994 0.000000 12.548828	-370.037994 0.000000 12.548828	0.000 -180.000 0.000
orgn:	935.351257 1924.607910 -18.643417	0.000 -90.000 0.000
spawn:	935.351196 1554.569946 -31.192245	-0.000 -90.000 0.000
2:spn	-0.000 -90.000 0.000
2:spn	-0	-90	0
2:spn	-0	-90	0
2:to	-0.000 -90.000 0.000
2:to	-0	-90	0
2:to	-0	-90	0
normal:	935.351196 1554.569946 -31.192245	-0.000 -90.000 0.000
TA-angl	-0.000 -90.000 0.000
TA-hash	-0	-90	0
TA-intg	-0	-90	0
TA-aget	-0.000 -90.000 0.000

dvdvideo1234 added a commit that referenced this issue Aug 23, 2021
…ady for merge yet.

Added: Angle grid snapper and renamed value snapper
Removed: Button argument
dvdvideo1234 added a commit that referenced this issue Aug 24, 2021
Fixed: Issue #31 and improved accuracy
Added: Portal catwalk
Added: Grid snapper and value snapper
Added: Snap assist will now draw point ID
Removed: Button argument from snap buttons
Utilized: `SetUnpacked` as it is faster
Improved: Offsets for PHX cross X
Improved: Other minor improvements
@dvdvideo1234
Copy link
Owner Author

Closed in #32

@dvdvideo1234 dvdvideo1234 linked a pull request Oct 25, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant