[BUG] nonsensical "Gradient" error with custom peices
Fennecai opened this issue · 4 comments
Describe the bug
After appending a new piece to the sv_TRACKASSEMBLY_PIECES
and the cl_
version too; my custom piece doesn't work with the curve work mode.
To Reproduce
Steps to reproduce the behavior:
- append the following to both the
sv_
andcl_
versions of theTRACKASSRMBLY_PIECES.txt
files located indata\trackassembly\dsv\
(github screws up the formatting, so here's a screenshot):
- load into your favorite map in Gmod
- equip the tool and switch the mode to "curve line segment fitting"; and select the fence model from the list
- make a curve and try to spawn the pieces
- See error
Expected behavior
I expected it to work like any other piece available; curving and stuff.
Actual behavior
It seems to incorrectly detect a "gradient" in the piece. I don't know why. I looked at the source code and it seems to think that the points aren't aligned or something weird like that.
Screenshots
see above
Host machine (please complete the following information):
- OS type: Windows
- OS version: windows 10
- Gmod platform: are you joking?
- Gmod branch: 36x64 beta, running in 64bit mode
- Gmod version: 2020-12-11
- Gmod instance: N/A
- Tool version: 8.622
Additional context
This isn't my normal setup; I'm stuck on a low-end laptop over the Christmas season and gmod doesn't run too well on this thing.
also, here are the files in case you don't want to type in the above screenshot text:
sv_TRACKASSEMBLY_PIECES.txt
cl_TRACKASSEMBLY_PIECES.txt
This is pretty weird since you given such angle [0,0,0] and [0,180,0]. I will be able to check this later this day.
It is probably a cache thing or a float manipulation.
- Have you tried restarting your game ?
- Where can I find this piece to check this for myself ?
You receive such error because this segment is treated as ramp piece, but it should not. What I mean by that exactly is the ones that make your train go from one plane to the next. They provide a ramp/hill that your vehicles need to climb in order to go higher. This filter detects whenever your piece active
and next
points have their forward vectors parallel but lying down on different lines:
This is an example of such piece ( This one is form SligWolf's MiniTrains
addon )
Hello,
Just checked this issue and it is not a bug, but rather miscalculated parameterization. Please look at the screenshot below,
so I can explain in greater detail:
The angles you have put are calculated internally relative to the these three lines in the middle, creating a coordinate system all together ( The RED X
, GREEN Y
and BLUE Z
(*)
). A local position 0,-32,0
means that the local offset of point 1
( in your case ) will have 0
as X, -32
as Y
and 0
as Z
based on the coordinate system (*)
, putting it right where the RED
SProps cube 6x6x6
is located. When looking at its angle 0,0,0
as a local offset being inserted, rotates the base angle for spawning
/stacking
right where the forward
and up
vectors of the coordinate system (*)
is angled at ( Same as RED:AngleEx(BLUE)
). So in your specific case point 1
is located at the RED
cube while pointing UP
and point 2
is located at the GREEN
cube ( As I see 0,32,0
as position and 0,180,0
as angle is used ) while pointing down ( -UP
). At this time when you try to use the curving algorithm, the validation checks this misplaced data and identifies it as a ramp piece due to the parameterization. You can have the screenshot duplication here.
In this case you can use the following parameterization to add this fence piece:
# SynchronizeDSV:(fence_@PIECES) 20-12-23 22:16:33 [ LUA ]
# PIECES:(MODEL TYPE NAME LINEID POINT ORIGIN ANGLE CLASS)
TRACKASSEMBLY_PIECES models/props_building_details/storefront_template001a_bars.mdl "Fences" "Fence" 1 "" "0, 32,1" "0, 90,0" ""
TRACKASSEMBLY_PIECES models/props_building_details/storefront_template001a_bars.mdl "Fences" "Fence" 2 "" "0,-32,1" "0,-90,0" ""
Store these values in F:/Games/Steam/steamapps/common/GarrysMod/garrysmod/data/trackassembly...
. Create the file .../dsv/fence_trackassembly_pieces.txt
and fill it with the information above ( You need only the lines NOT starting with #
. Aka not being comments that is ;) ). When done edit or create the following file and at the end of it add the value fence_
: .../trackasmlib_dsv.txt
. When you do that correctly you will have external pluggable database and you will only update your fence_
dedicated DSV file ( Ignore that it is written test_
. Imagine it is fence_
):
The second database extension is better at this case because you can make and support you own DSV files containing only your dedicated pieces. You can back these up in case you reinstall your server or if you have something else in mind.
ah...ok; well, i didnt understand much of this at all (im not using the e2 cause your tutorial videos arent very clear) but thanks.. to clearify; the cubes are exactly where i wanted them to be, so i still dont understand what is making my angles incorrect
@Fennecai
The angles must not be relative to the world, but rather to the prop's local coordinate system (*)
.
You can use this E2 script if you are having trouble creating active points. Cheers!
The position of the cube becomes the active point origin
and the angles
of the cube ( According to forward RED
and up BLUE
when you turn on the picker 1
cheat in the console ) become the active point angular offset. The E2 script makes all the translations and rotations for you automatically so I thought it is rather easier.