Selection Box coords; support for semi-trucks.
Posted: Mon Jul 24, 2017 10:43 am
I was working with a train on horizontal tracks, and attempting to move the selection box (and bounding box) to the left to be biased toward the left around the center. While I was reducing the Y coord of the selection box (which was claimed to be an AABB box) the rectangle kept moving up AND left.
So I moved the train to a vertical orientation and started there with -1,-1 to 1,1 . Then interitivly move the box up a bit, moved the bottom up a bit, etc... all was working as expected. Then I decided to record the settings and make a composite. Repeated. Moved the train to hoizontal track and took screenshots of the same coordinates.
I'm baffled how factorio manages to draw everything so well
I used some purple lines to make sure the images were all aligned with each other; decided to include them for reference on the output. What I was attempting to do, was to setup a bounding box for connection points that are closer toward the center and offset; much like a Semi truck tractor. And then I was going to make the trailer part as another type of wagon. But the selection and collision box seem to be aligned the same so .. I can't move the selection box to the left when the tractor would be facing horizontally... and there's no horizontal shift correction, only vertical_shift.
I know it's really not that difficult to rotate around an origin 0,0.... and it must have taken some intersting math to get this effect out.
I'd probably have to settle for a single image that's a semi with trailer that just moves flat around a road (when alternate track types ever get implemented) but I decided I could just enforce the constraints manually and just never merge the track types but always make them cross instead so trucks will stay on truck rails (roads) and trains on train rails.
So I moved the train to a vertical orientation and started there with -1,-1 to 1,1 . Then interitivly move the box up a bit, moved the bottom up a bit, etc... all was working as expected. Then I decided to record the settings and make a composite. Repeated. Moved the train to hoizontal track and took screenshots of the same coordinates.
I'm baffled how factorio manages to draw everything so well
I used some purple lines to make sure the images were all aligned with each other; decided to include them for reference on the output. What I was attempting to do, was to setup a bounding box for connection points that are closer toward the center and offset; much like a Semi truck tractor. And then I was going to make the trailer part as another type of wagon. But the selection and collision box seem to be aligned the same so .. I can't move the selection box to the left when the tractor would be facing horizontally... and there's no horizontal shift correction, only vertical_shift.
I know it's really not that difficult to rotate around an origin 0,0.... and it must have taken some intersting math to get this effect out.
I'd probably have to settle for a single image that's a semi with trailer that just moves flat around a road (when alternate track types ever get implemented) but I decided I could just enforce the constraints manually and just never merge the track types but always make them cross instead so trucks will stay on truck rails (roads) and trains on train rails.