Brush-entities ignore the origin property and always end up positioned at the center of their geometry, making it impossible to make rotating entities with TBLoader (doors, levers, fans, etc).
It would be nice if one could define the point of rotation, by defining the origin property in TB.
(TB doesn't currently have a good way to edit origins, but one can use a dummy point-entity, and copy-paste the origin value to the brush-entity.)
I tackled this in my fork and I found a possible fix. I found that libmap itself seems to create brush geometry relative to the entity's center or something, so fixing this at a core level might be tricky. Also because changing that code will also affect world geometry.
So the way I fixed it is perhaps a little hacky, but seems to work fine. Basically it's just two steps:
don't position the node at ent.center if it has an origin property
if it has origin, then adjust the position of its children (ent.center - origin)
(Ignore the switch-case changes at the bottom of that commit, as they're irrelevant to the issue. That was just my OCD being triggered by unindented cases.)
Brush-entities ignore the
origin
property and always end up positioned at the center of their geometry, making it impossible to make rotating entities with TBLoader (doors, levers, fans, etc).It would be nice if one could define the point of rotation, by defining the
origin
property in TB.(TB doesn't currently have a good way to edit
origins
, but one can use a dummy point-entity, and copy-paste the origin value to the brush-entity.)I tackled this in my fork and I found a possible fix. I found that libmap itself seems to create brush geometry relative to the entity's center or something, so fixing this at a core level might be tricky. Also because changing that code will also affect world geometry.
So the way I fixed it is perhaps a little hacky, but seems to work fine. Basically it's just two steps:
ent.center
if it has anorigin
propertyorigin
, then adjust the position of its children (ent.center - origin
)(Ignore the switch-case changes at the bottom of that commit, as they're irrelevant to the issue. That was just my OCD being triggered by unindented cases.)