-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add radius threshold to box selections #1607
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks decent, though not following existing volumes as far as allowed shapes is pretty sad.
rts/Sim/Objects/SolidObject.h
Outdated
@@ -383,6 +383,7 @@ class CSolidObject: public CWorldObject { | |||
LocalModel localModel; | |||
CollisionVolume collisionVolume; | |||
CollisionVolume selectionVolume; | |||
float selectionRadius = 0.0f; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't there some neat convenience function to check CollisionVolume
's distance to a plane? It would be good not to converge on a worse solution (for example only being able to do a sphere would fail hard for elongated units).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately only a distance to point exists
It's tempting to propose you use |
Using the existing selection volume (without an opt-out) would be pretty bad, see the middle section (with sc2 protoss screenshots) of #671 (comment) |
Co-authored-by: sprunk <[email protected]>
Co-authored-by: sprunk <[email protected]>
Perhaps you're right. |
rts/Sim/Units/Unit.cpp
Outdated
@@ -307,6 +307,8 @@ void CUnit::PreInit(const UnitLoadParams& params) | |||
|
|||
harvestStorage = unitDef->harvestStorage; | |||
|
|||
selectionRadius = unitDef->selectionRadius; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you copy this as a separate variable, so it could be changed on a per-unit basis?
Otherwise u->unitDef->selectionRadius
might work equally well in places you now use u->selectionRadius
.
Not a big deal, just curious.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I remember seeing some gadget that would scale unit sizes, maybe from sprung? Although I do not know how well supported that is with other engine things like collision volumes.
LGTM overall 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This needs a proper box/sphere intersection test in order to not get false positives in the drag selection. |
Adds a unitdef for a spherical threshold for box selecting units. A default value of 0 leaves the current behavior unchanged.
#671