Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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
0
Question by Robert Carlsson · Jan 22, 2013 at 04:44 PM · raycastfieldofview

Raycast from a 3rdp controller

So the issue I'm having is that I'm trying to check if a "enemy" or obstacle is within my visual radius. If it is then set col.gameObject.renderer.enabled = true; As it is now im only checking if they are within a certain distance of the player, but I want to narrow it down to the field of view.

My characters field of view is cone shaped (he's holding a flashlight with a spotlight attached to it) and as long as the gameobjects aren't inside the light they should be hidden (renderers turned off).

What is the best way to solve this, have had a lot of problems with raycasting and such, so I'm now turning to the forum for help

Regards Robert

Comment
Add comment · 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 sdgd · Jan 22, 2013 at 05:47 PM 0
Share

hm spot light

try with search light and if it is in radius of search light than ok

you can set distance of search light

it has cone shape you can change the ° of it well I'd give code but I'm not there yet just giving some directions on how would I try solving

even more you can turn it's illu$$anonymous$$ation to 0 and it does not light in front of you

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Robert Carlsson · Mar 17, 2014 at 10:39 PM

Sorry that I haven't replied. The way I solved it was by checking if an enemy was within my screen(or visual range). Then I calculated if the enemy was within an angle of -22.5 to + 22.5 infront of me. If it was I rendered it, otherwise I didn't.

Will mark it as solved.

Comment
Add comment · 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.

Follow this Question

Answers Answers and Comments

10 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

Related Questions

Fog Of War with line of sight - Tons of raycast or better solution? 0 Answers

Enemy Ai Field of View 0 Answers

How to make Syndicate-style civilian AI without horrible slowdown? 2 Answers

How can I get the rotation of Handles.DrawLine to match up with an Objects forward? 0 Answers

Field of view, using raycasting 5 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