• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
Question by hlvo · Sep 27, 2019 at 03:01 AM · programmingdetectionprojectorspotlightvisualization

Help 3D Enemy Detection Visual Feedback

Hello, all of you. I need to develop a detection system for a game boss I'm working on. He sees in a cone originated in his head, if the player enters into that cone, he is seen. Things to consider:

-If a player is behind an obstacle, he is not seen.

-There's variation in terrain elevation, so if he's looking for something on top, he doesn't see below, and vice-versa.

Programming this system is easy, but I need a visual indicator of where the boss is looking at. If I put a spotlight on his head, there's a light intensity variation for things closer or farther apart, and I need that indicator to be uniform.

If I use projectors, the projectors render in meshes behind the obstacles too, which cannot happen.

This height variation of terrain that prevents me from using the great solutions I've found.

I tried to find a way to leave the intensity of uniform light everywhere it reaches, or that projectors do not render behind the first object that it encounters, but without success.

Does anyone have the answer to these problems or other solution?

Thank you so much. And I'm sorry if it was hard to understand, English is not my main language.

Comment

People who like this

0 Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image WarmedxMints · Sep 27, 2019 at 09:06 AM 0
Share

This asset should do the visuals nicely for you - https://assetstore.unity.com/packages/vfx/shaders/volumetric-light-beam-99888

3 Replies

· Add your reply
  • Sort: 
avatar image

Answer by Mouton · Sep 27, 2019 at 07:39 AM

Use a mesh with a cone shape, attach it to the head of your animated model and use a semi-transparent material. This should do the trick.


Alternative

If you need to display the boss sight area on the ground so the player can avoid it you will need to project it onto the ground and concerned objects.

Look at this discussion on the forum on how to implement this solution (look at chris64 answers): https://forum.unity.com/threads/rendering-an-aoe-area.112163/

Comment

People who like this

0 Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image hlvo · Oct 04, 2019 at 01:20 AM 0
Share

The problem in this solution is that some things on the scene blocks the boss vision. I would need something to make the projector not render in some areas inside his vision, like some type of mask. I can't find something of the sort.

avatar image Mouton hlvo · Oct 04, 2019 at 08:33 AM 0
Share

If you need the area take in account the environment, you can either write a shader that takes in account obstacles, or use a particle system with collisions enabled.

avatar image

Answer by akaBase · Sep 27, 2019 at 09:59 AM

When I was researching a similar issue I came across this tutorial showing how to create a FOV systsem using Raycasting which i think is exactly what you are after.


Field of View Tutorial


Comment

People who like this

0 Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image hlvo · Oct 04, 2019 at 01:18 AM 0
Share

Unfortunately this doesn't work because the height variation of terrain.

avatar image akaBase hlvo · Oct 04, 2019 at 11:36 AM 0
Share

Then add the 3rd dimension to it by adding top and bottom Rays with the gap inbetween middle and either side no more than the min height of the player.

See attatched image.

alt text

avatar image

Answer by celrackov · Oct 04, 2019 at 11:06 AM

There is a site called livebook where I read an article dedicated to your question. Tr to find it there

Comment

People who like this

0 Show 0 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

128 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

True 3D Selection for RTS 2 Answers

Overlapping shape detection 1 Answer

sunlight detection for vampire 0 Answers

How to make blood splatter using projectors(or decals) 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges