View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0005026 | Spring engine | General | public | 2016-01-05 03:52 | 2016-01-18 16:52 | ||||||||
Reporter | Shadowfury333 | ||||||||||||
Assigned To | |||||||||||||
Priority | normal | Severity | feature | Reproducibility | N/A | ||||||||
Status | new | Resolution | open | ||||||||||
Product Version | 100.0+git | ||||||||||||
Target Version | Fixed in Version | ||||||||||||
Summary | 0005026: Lua Call or Callin to determine units about to be selected | ||||||||||||
Description | Some way to query the engine about what units would be selected if the user were to release the left mouse button. Perhaps a call, ex. GetUnitsInSelectionBox(), returning a list of unitIDs (similar to GetSelectedUnits()) or a callin, ex. UnitPreSelected(unitID) and UnitUnPreSelected(unitID), which pass in the unitIDs for the units that have just been added or removed from the selection box. I'd prefer both, but either one works. | ||||||||||||
Tags | No tags attached. | ||||||||||||
Checked infolog.txt for Errors | |||||||||||||
Attached Files |
|
![]() |
|
gajop (developer) 2016-01-05 05:13 |
-1 This makes the selection work only for units and rectangular selection boxes which is very limited (useless for me in case of Scened for example). What you really want is to have a reasonable result for Spring.TraceScreenRay when x and/or z are out of map bounds (an intersection with a 0,0 plane most likely), and then you can implement whatever type of selection you want easily. |
Shadowfury333 (reporter) 2016-01-05 05:43 Last edited: 2016-01-05 05:44 |
Okay, what about "GetSelectionBoxActive()" along with returning the engine's own backup result for screen tracing when TraceScreenRay goes offmap? I know it selects some point in the distance when selection starts offmap. Knowing whether or not the selection box (or whatever shape) is active is otherwise a matter of querying a big mess of states, some of which are set by other widgets (such as the map drawing one for ZK), but still make selections not a thing on mouse release, and the engine seems to know that. |
quantum (reporter) 2016-01-05 08:54 Last edited: 2016-01-05 08:59 |
Gajop, this feature is meant to allow the highlighting of units that are inside the selection box. Box selection is implemented in the engine, so currently modders need to re-create a duplicate implementation in Lua, which will break when something changes in the engine. |
Shadowfury333 (reporter) 2016-01-05 09:05 |
Oh, I should also ask for something like "IsSelectionBoxActive()" as well. Since I'm also doing hover highlighting, and that's only valid for selection when the box isn't active (along with a couple other mouse states, but those are easily accounted for). When the box is active, it only checks against unit midpoints, while single unit selection compares a point to the unit's entire bounding volume, so a unit selectable by clicking and releasing is not necessarily selectable by clicking, dragging a short distance, and then releasing |
gajop (developer) 2016-01-05 14:02 |
what about "GetSelectionBoxActive()" -> would be nice to have I agree I should also ask for something like "IsSelectionBoxActive()" -> isn't that whatGetSelectionBoxActive() was supposed to do? @quantum: It's also mostly TA-ism which assumes you can only select your own or allied units (and not enemy units, features, projectiles or other objects that might be rendered). It's easy to recreate functionality if you have good TraceScreenRay which would be much more important to add. |
Shadowfury333 (reporter) 2016-01-05 20:36 Last edited: 2016-01-06 01:55 |
A more robust TraceScreenRay is an independently super-important feature, and should probably be it's own request anyway. Having GetUnitsInSelectionBox() deals with the most common case trivially, in combination with something like GetSelectionBoxBounds() and IsSelectionBoxActive() would, with a properly robust TraceScreenRay(), allow for the flexibility you want without forcing every game to re-implement the logic for what units should be selected. Given how, for instance, spectator fullselect state operates this isn't that trivial. Note that if something isn't using the engine's standard rectangle selection then they've probably implemented everything into a widget, and can expose alternate functions along WG for their selection shapes. |
Shadowfury333 (reporter) 2016-01-11 23:04 Last edited: 2016-01-11 23:08 |
https://github.com/ZeroK-RTS/Zero-K/blob/66ceda9948f121cfbd4629cc68e9c617d54e6af2/LuaUI/Widgets/api_preselection.lua#L19-L33 is what I've come up with as an API for the Zero-K selection widgets. It seems to work pretty well, though I'm debating a "checkSelectable" parameter for GetUnitUnderCursor(), which if false would just return the unit regardless of mouse button states or other selection restrictions. This, along with TraceScreenRay() adding support for off-map coordinates, and the previously mentioned GetSelectionBoxBounds() being added as well, should solve everyone's issues |
Kloot (developer) 2016-01-11 23:10 |
What *exactly* is TraceScreenRay supposed to do if it doesn't hit the map? Intersect the y=0 plane? |
Shadowfury333 (reporter) 2016-01-12 01:35 Last edited: 2016-01-12 01:35 |
Whatever it does when you click off map for the selection box. That clearly is tied to a location in the world, seeing as the camera moving keeps the selection box start point at the world-space location both on and off the map. I'm guessing that does a project to the far plane and stores that location. |
gajop (developer) 2016-01-12 07:37 |
"What *exactly* is TraceScreenRay supposed to do if it doesn't hit the map? Intersect the y=0 plane?" -> Yes, that would be a good start. Another easy change would be to allow users to specify the y value of the plane to intersect with. For future I'd like it if users could specify (in a different callout) arbitrary shapes that could be tracerayed, but let's leave that out for now. |
gajop (developer) 2016-01-18 10:19 |
Haven't tried it yet but it seems Kloot has implemented the improved TraceScreenRay: https://github.com/spring/spring/commit/7b900a5c38c534484646c81044cfecbbc1007886 Thanks! |
Shadowfury333 (reporter) 2016-01-18 16:17 Last edited: 2016-01-18 16:19 |
So, that returns plane position on hitting sky, but does that mean it returns the farplane (or whatever the engine selection logic uses for offmap coordinates) or the plane of ground at 0? |
Kloot (developer) 2016-01-18 16:52 |
As the commit message says, it intersects with a user-specified plane (0,1,0,D). I do not plan to replicate box selection logic in TraceScreenRay. |
![]() |
|||
Date Modified | Username | Field | Change |
---|---|---|---|
2016-01-05 03:52 | Shadowfury333 | New Issue | |
2016-01-05 05:13 | gajop | Note Added: 0015447 | |
2016-01-05 05:43 | Shadowfury333 | Note Added: 0015448 | |
2016-01-05 05:44 | Shadowfury333 | Note Edited: 0015448 | View Revisions |
2016-01-05 08:54 | quantum | Note Added: 0015449 | |
2016-01-05 08:58 | quantum | Note Edited: 0015449 | View Revisions |
2016-01-05 08:59 | quantum | Note Edited: 0015449 | View Revisions |
2016-01-05 09:05 | Shadowfury333 | Note Added: 0015450 | |
2016-01-05 14:02 | gajop | Note Added: 0015451 | |
2016-01-05 20:36 | Shadowfury333 | Note Added: 0015452 | |
2016-01-05 20:37 | Shadowfury333 | Note Edited: 0015452 | View Revisions |
2016-01-05 20:37 | Shadowfury333 | Note Edited: 0015452 | View Revisions |
2016-01-05 20:38 | Shadowfury333 | Note Edited: 0015452 | View Revisions |
2016-01-06 01:55 | Shadowfury333 | Note Edited: 0015452 | View Revisions |
2016-01-11 23:04 | Shadowfury333 | Note Added: 0015479 | |
2016-01-11 23:04 | Shadowfury333 | Note Edited: 0015479 | View Revisions |
2016-01-11 23:07 | Shadowfury333 | Note Edited: 0015479 | View Revisions |
2016-01-11 23:08 | Shadowfury333 | Note Edited: 0015479 | View Revisions |
2016-01-11 23:10 | Kloot | Note Added: 0015480 | |
2016-01-12 01:35 | Shadowfury333 | Note Added: 0015484 | |
2016-01-12 01:35 | Shadowfury333 | Note Edited: 0015484 | View Revisions |
2016-01-12 07:37 | gajop | Note Added: 0015488 | |
2016-01-18 10:19 | gajop | Note Added: 0015538 | |
2016-01-18 16:17 | Shadowfury333 | Note Added: 0015540 | |
2016-01-18 16:19 | Shadowfury333 | Note Edited: 0015540 | View Revisions |
2016-01-18 16:52 | Kloot | Note Added: 0015541 |