Open willemmulder opened 12 years ago
I think I misphrased my question: with 'area' I simply mean a imaginative rectangle that the user draws with his mouse (mouseDown, move, mouseUp) on the canvas.
The user thereby does not necessarily click or move over any existing objects, but simply 'draws around' a certain area. Now I want to know which objects are in that area and trigger an event on them.
i think i understood it as you meant it
an object may exist in the tree but not on the screen. you could do no material, or play with object3d.visible
you would detect collition on this object, and then "capture" on the children
I don't really mean the relation between children and parents and trees, but simply wonder how I could achieve this:
Imagine a field with units (simple cubes) on it. There's many units, all over the screen. Now I draw a rectangle around some units in the center of the screen. How can I detect which units were selected?
The units are not in a tree or anything, they are directly added to the scene.
Bonjour!
I'm currently creating an RTS and was thinking on how to implement bounding box selection. What would be very cool to have is a function 'onWithinBoundingBox' on any object, which is triggered when the user selects an area on the screen and the object is within that area.
So: user selects an area (i.e. mouseDown, move, mouseUp) on the screen, all objects within that area get the 'onWithinBoundingBox' event triggered. When the user clicks somewhere else, the objects get the 'onOutisdeBoundingBox' event triggered.
Would that be hard to make?