Jump to content

How would one implement a "selected" circle?


RygtY
 Share

Recommended Posts

A standard trait found in all known RTS games is the ability for the player to select a character or object.

 

I understand that this engine has the Pick function which more or less performs the act of selecting an object, but I am not sure how one should draw a circle on the terrain on which the object resides to show that the object is selected.

 

I booted up my copy of Warcraft III as well as some other RTS games that use a 3D engine and found that the circle conforms to the surface of the terrain. That means that the circle most likely a non-repeating texture that is only draw on the terrain when a unit is selected.

 

I looked up the Textures section of the documentation, but I am still rather stumped. I would really appreciate it if someone could explain how one should go about implementing this feature.

Link to comment
Share on other sites

I have that functionality already in my RTS code.

 

However i don't draw directly on the terrain but just draw a 2D rectangle.

If you wan't to do it like that, i can help.

 

//Edit. sorry again missunderstood the post. Sometimes rereading it helps.

 

i currently just show the health of selected units when they are active. Mostly just as Command & conquer does it. (at least the c&c parts i know and played.)

Link to comment
Share on other sites

I did this once in LE 2.x where I had a plane that I put a texture on it. Then I would take every vertex of that plane and cast a ray downward until it hit something. Then I would set that planes vertex to the Y collision. If you do that with all vertices then it'll hug the terrain/whatever. The more verts the longer this process will take but the better hugging you'll get. If your terrain is very hilly then you'd want more. I don't know if Lua gives us vertex manipulation access though.

Link to comment
Share on other sites

...way i have implemented this in one of my classes at uni is rather different..basically, geometry was exported with 2 UV channels, and corresponding textures representing circles around characters, were simply drawn with specific blend mode, on to 2nd UV channel, where UV coords for 'decal' (it was not decal, but lets call it that way), are taken from specific character position..works perfect, wrapping perfectly over geometry without any issues, and its extremely simple and fast, doesnt require any physics and it can work on every toaster out there..

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...