armory
armory copied to clipboard
Mouse box select mode
wanted somewhen to try make strategy game since armroy have GPU armatures for many units.. but i realized that like almost most thigns need make from scratch and so noobs like me need be math scientist to do so thats why i wanted ask for box select logic node so that can select units like in strategy games..
Hi, this node sounds a bit overly specific to me, at least for the default set of logic nodes that come with Armory. I guess it would fit better to https://github.com/armory3d/logic_pack.
How would you propose this node to look like? I could imagine that it is very specific to the actual game.
I'm currently not interested in implementing this, but if I would then I'd probably implement it as follows, hoping that it fits most use cases:
Inputs:
- Z Level: global z coordinate (implying that the box selection works only on a plane)
- Z Threshold: max. deviation of object coordinates from the specified z coordinate in order for objects to be selected
- Objects: array of objects that are selectable
- Filter Function (optional): the name of a filter function (see the
Function
andCall Function
nodes) that is called for each object in the selected area and returns a boolean that decides whether that object can actually be selected or not.
Outputs:
- Selection Active (Action socket)
- Selection Started (Action socket)
- Selection Finished (Action socket)
- Selection Cancelled (Action socket) - how would this be implemented? The user may want to use different keys for this
- Starting Coords (3D vector): representing one vertex of the selection area
- Current Coords (3D vector): representing the opposite vertex of the selection areay
- Selected Objects (Array of Objects): evaluated all the time while the selection is "running" because you may want to highlight objects during selection.
The user then is responsible to do (if desired):
- bounds checking
- custom logic if grid cells or groups of entities should be selected instead
- rendering of the selection box based on the node's outputs.
What do you think about this?
for selection canceled i think to choose mouse and or keyboard and choose button which to press to able to cancel would very cool and easy wow i think this design describtion is super good and dunno for now what to else would need to add
I think it just needs a way to get all the objects being rendered via logic nodes, this makes possible to iterate and check whether they are inside the selection box using screen coords.
The selection box may be a bit tedious to setup, because it can be flipped (if you move the mouse back to the start point), maybe deserves a node too, but more general:
Inputs: position, start position, end position output whether the position is inside the box