Highlighting Selection

Blitz3D Forums/Blitz3D Beginners Area/Highlighting Selection

boomboom(Posted 2007) [#1]
Hi, I wasn't sure where to post this, so I thought here was a good a place as any.

I am having difficulty deciding what to do to show an entity is selected. For example, when you select a unit in a RTS game, there is some kind of visual representation of it being selected (a change of color, or a disk around its feet).

Firstly I don't want to copy my mesh and then do things to the copied version (I have some really heavy models), and I also don't want to do anything like changing the colour of the mesh or texture, as then I have to store the old texture handle somewhere to place back onto it when its not selected.

Anyone got any suggestions?


jhocking(Posted 2007) [#2]
Well the simplest thing would be to just draw a circle around the selected entity (use CameraProject to determine where to draw, and make sure to do it after RenderWorld but before Flip.) Didn't Starcraft draw green boxes around selected units? That's a simple computery look (ie. depends on if you want a computery look.)

Ultimately this depends a lot on the look of your game. Obviously specific effects will vary in appropriateness for different aesthetics.


Stevie G(Posted 2007) [#3]
You could have alpha'd bounding cubes, cylinders or spheres displayed when selected, small arrow sprites above the unit, a circle mesh at it's base etc...

It really depends on the style of your game and the rest of the user interface. I wouldn't recommend the old 2d over 3d though - simply due to the slowdown you'll experience on some cards.

Stevie


boomboom(Posted 2007) [#4]
What about looping through all the verts in the model and setting thier vert color to red. Then switching them to use vert colour when there selected (using entityfx) then when there not selected setting entity fx to 0

Would this actually work? as in when entity fx was at 0 it would show the texture/base colour normally, and only shwo the red when vertex colours where turned on?


jhocking(Posted 2007) [#5]
That'd work, but again the look may or may not be what you want. Try it and see!

@stevieg: oh yeah I forgot about slowdown from mixing 2D and 3D commands.


Stevie G(Posted 2007) [#6]
@ boomboom - it'll definately work - use it myself in my current project and it has the added bonus of being able to preprocess the vertexcolors so it almost instant.


Ross C(Posted 2007) [#7]
I used 3d boxes, with a touch of alpha. Just looped through the vertices, found the -x most one, +x most one, the -y most one... etc, then scaled my bounding box to it. I made it a touch bigger than the actual dimensions.


Smith(Posted 2007) [#8]
A quick solution - if you're not using the alpha for anything else - would be to make the currently selected object half transparent.