Join Dan Violet Sagmiller for an in-depth discussion in this video Building follows mouse, part of Build a Real-Time Strategy Game with Unity 5.
- [Voiceover] In modern RTS games when creating a building…an outline of that building typically follows the mouse…around to help you find the location to place it.…We'll add that same ability for a transparent building…to follow around the mouse.…To do that, let's go to the scripts folder…and I'm going to right click and create a new C sharp script…and I'm going to call it Find Building Site.…I'm going to edit Find Building Site now.…All I need from this is the update,…so I'll delete the start.…This model behavior intends to be attached…to a ghost shell of a command base…or some other building.…
The idea is that this will tell it…to follow the mouse around.…In order to do that we're going to need to find…out exactly where on the terrain our mouse is hitting it.…We've already created a method for that.…So we'll use it.…var tempTarget = rtsmanager.Current.ScreenpointToMapPosition…and we pass in the mouse position, input.mouseposition…Now if we don't have a value from this…then nothing to do but if tempTarget.HasValue = false…
AuthorDan Violet Sagmiller
- Adding player positions and start info
- Loading prebuilt levels
- Adding camera moves
- Adding a unit
- Supporting navigation
- Adding unit owners and player objects
- Importing and setting up a HUD map
- Adding unit info and credits
- Creating HUD actions
- Building a command base
- Adding artificial intelligence
- Adding battle actions
Skill Level Intermediate
Unity 5: 2D Essential Training (2015)with Jesse Freeman3h 22m Intermediate
1. Initial Setup
2. Adding a Unit
3. Navigation Mesh
4. Unit Owner
5. HUD Map
6. Unit Info & Credits
7. HUD Actions
8. Command Base
9. Base AI
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.