I was making a mod with flying units (flying - means its graphics and selection box shifted upwards from entity centre (Y -= 3 in my case) and it has empty collision mask). And I noticed that selection box acts weird - as my unit was wandering around and I was hovering my mouse cursor over its selection box, selection box kept appearing and disappearing where it shouldn't.
I made a little mod (in attachment, just start new game) to reproduce a problem on standing still vanilla biters with shifted upward selection box. Problem do not seems to be appear on vanilla entities where selection-box is small enough or not shifted that high up. Edges where selection box shows and hides seems to be aligned with horizontal lines with even coordinates (Y = -4-2,0,2,4), so I hope this is just some miscalculation bug.
Video showing the problem: https://www.dropbox.com/s/sxcoqv0i08nwo ... 0.mp4?dl=0
[0.14.9] [rrrola] Selection box mouse hit problems
- akastalker
- Burner Inserter
- Posts: 12
- Joined: Mon Jun 27, 2016 10:52 pm
- Contact:
Re: [0.14.9] Selection box mouse hit problems
The selection box rectangle doesn't have [0, 0] inside, which is not valid specification.
Re: [0.14.9] [rrrola] Selection box mouse hit problems
I added the check and error message to the loading code.
- akastalker
- Burner Inserter
- Posts: 12
- Joined: Mon Jun 27, 2016 10:52 pm
- Contact:
Re: [0.14.9] [rrrola] Selection box mouse hit problems
Alright. So, can I force my object to render above high entities (like trees or poles) with its center within its graphics? Or do I have to make selection box underneath its graphics?
Re: [0.14.9] [rrrola] Selection box mouse hit problems
You can make the graphics to be higher, every sprite/animation etc. has the property shift. (It is used in base on many places)akastalker wrote:Alright. So, can I force my object to render above high entities (like trees or poles) with its center within its graphics? Or do I have to make selection box underneath its graphics?
- akastalker
- Burner Inserter
- Posts: 12
- Joined: Mon Jun 27, 2016 10:52 pm
- Contact:
Re: [0.14.9] [rrrola] Selection box mouse hit problems
Sorry for bothering you with this again, but...
Though, I had to lift it quite a lot: trees are high, so 3 tiles up did make my entity look like it's not crawling under trees.
Then I wanted to have selection box over my graphics, so I shifted it up 3 tiles too, and it started this weird behaviour.
Base flying robots are shifted only 1 tile up (graphics and selection boxes), but they seems to be rendering in different pass overlapping only each other (even big electric pole cannot overlap them).
Shifting selection box only 1 tile up doesn't trigger the problem, but It is not enough to make real flying selectable unit.
I think, I just remove my selection box. Looks like it's not worth it. I cannot even select it in heavy-belted area - only belt can be selected and there are no gap between them to select my entity. Also, you cannot mine logistics/construction robots in this situation - you mine building\belt\tree under it instead (can't tell if this is bug or by design).
But all base robots don't have itkovarex wrote:The selection box rectangle doesn't have [0, 0] inside, which is not valid specification.
Code: Select all
type = "combat-robot",
name = "defender",
...
selection_box = {{-0.5, -1.5}, {0.5, -0.5}}
I already shifted my graphics up and its shadow right from centre of entity. It's the only way I found to render graphics above trees.You can make the graphics to be higher, every sprite/animation etc. has the property shift. (It is used in base on many places)
Though, I had to lift it quite a lot: trees are high, so 3 tiles up did make my entity look like it's not crawling under trees.
Then I wanted to have selection box over my graphics, so I shifted it up 3 tiles too, and it started this weird behaviour.
Base flying robots are shifted only 1 tile up (graphics and selection boxes), but they seems to be rendering in different pass overlapping only each other (even big electric pole cannot overlap them).
Shifting selection box only 1 tile up doesn't trigger the problem, but It is not enough to make real flying selectable unit.
I think, I just remove my selection box. Looks like it's not worth it. I cannot even select it in heavy-belted area - only belt can be selected and there are no gap between them to select my entity. Also, you cannot mine logistics/construction robots in this situation - you mine building\belt\tree under it instead (can't tell if this is bug or by design).
Re: [0.14.9] [rrrola] Selection box mouse hit problems
This is why for selection box, the 0,0 can be at most 0.5 far from the bounding box. It needs to be generally near, as the logic of searching for entity to be selected is based on the collision box which is based on position. So when the selection box is too far, the entity isn't found when searching things to select.