Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: Intoccabile on November 20, 2012, 11:22:23 PM
-
Hi all,
I have been working on an rts design for shits and giggles. I have it so that you can individually select and move units. I need to be able to select multiple units though. To do this I need to be able to draw a selection box on screen and everything in that box gets selected.
I have absolutely no idea how to even start looking at this.
Any help would be greatly appreciated.
Regards,
Intoccabile
-
Hi,
Indeed, this is already pretty involving.
you need to cut down the problem into digestable chunks:
1: drawing a rectangle on screen: for this, Vectrosity is just perfect, and I created a bridge so you can work it out in PlayMaker:
https://hutonggames.fogbugz.com/default.asp?W948 (https://hutonggames.fogbugz.com/default.asp?W948)
2: Selecting objects within screenspace:
You would simply go trhough all gameObjects in the scene ( likely filtered by tag or layer) and then verify if their position is within the selection.
3: Storing the selection:
I would go with ArrayMaker anyway:
https://hutonggames.fogbugz.com/default.asp?W715 (https://hutonggames.fogbugz.com/default.asp?W715)
You could store all your selected gameObjects into an Array as you scan them in point 2.
This is an interested question, and I feel this could win with some custom Actions for this process to be easy for PlayMaker users, so allow me few days to come up with a working example. Can you bump this thread next week if I haven't had time to look at this? thanks,
Bye,
Jean
-
I know this thread has died but there was never a followup. I recently obtained Vectrosity for this exact purpose and am having trouble figuring out how to not only draw a rectangle that changes as I drag it but also how to be able to add objects that are selected into an array. Thanks for any help you guys can provide.
-
Hi,
ok, keep bumping this thread. it's very important, and definitly something I want to add to ArrayMaker as a sample.
Please bump this next week ok? I need to first make a new version of arrayMaker to take full advantages of the new cool features of playmaker, and I'll do that selection system as well.
bye,
Jean
-
Thanks Jean. Here is the bump you requested.
-
I recently obtained Vectrosity for this exact purpose and am having trouble figuring out how to not only draw a rectangle that changes as I drag it but also how to be able to add objects that are selected into an array.
While the features are being worked on; check out the SelectionBox example scene in VectrosityDemos, it does the drawing part you are looking for.
-
Hi,
ok, I did a fully working sample, tight with arrayMaker as well, that doesn't required any third party plugins like vectrosity. Will do one using vectrosity, but this is for later.
https://hutonggames.fogbugz.com/default.asp?W715
If you have any questions, let me know. It's pretty advanced I feel, while the concept is simple, coming up with a stable, reliable and efficient system requires some careful thinking and crafting, so experiment once you have studied that sample so you understand where the pitfall can be ( especially around who is responsible to check for selection, and how often it should check)
bye,
Jean