Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
0
Question by isteffy · May 13, 2016 at 05:41 PM · collisiongameobjectsizefovvision

Field of Vision obstructed when colliding w/ a gameobject


This image explains what I want in a nutshell for a unit in an RTS

alt text

Essentially, the Field of Vision gameobject in the image would have a script attached to it that morphs shape when it runs into a new gameobject.

I have no idea how to code this script. It emulates what a person's field of vision would look like if he looked at a wall. He cannot see through the wall so his field of vision shrinks slightly.

Here is what the field of vision would look like with no obstruction.

alt text

@MJMC brought up a good point so I must add that: the player can see the other side of obstructing gameobject, but the gameobject cannot. Think of a unit from Command and Conquer or Starcraft. the field of view gameobject must be able to detect collisions.

Tutorial link : https://www.youtube.com/watch?v=rQG9aUWarwE Note: I think the title for this question is horrible! Suggestions welcome :)

3.jpg (47.9 kB)
4.png (263.3 kB)
Comment
Add comment
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

2 Replies

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

Answer by isteffy · May 17, 2016 at 06:59 AM

@SebastianLague This two-part tutorial is above and beyond what I wanted. No cameras needed, only some slick trigonometry which Sebastian does for you.

Part 1(basics) https://www.youtube.com/watch?v=rQG9aUWarwE∈dex=4&list=PLrWUz1h2nDpPdne1qzCt6Je1BUNWh8Ckm

Part 2 (more making the field of vision visible) https://www.youtube.com/watch?v=rQG9aUWarwE∈dex=4&list=PLrWUz1h2nDpPdne1qzCt6Je1BUNWh8Ckm

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
avatar image
1

Answer by Nazirzadeh · May 13, 2016 at 06:30 PM

Of course it is horrible :)

Do you want to see the other side of the wall? If yes you can add a second camera a little bit ahead of your main camera and deactivate it, after reaching to the wall you can deactivate first camera and activate second one.

Comment
Add comment · Show 3 · 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 isteffy · May 13, 2016 at 07:05 PM 0
Share

The game is a top down RTS, so you as the player can see the other side of the wall, however the gameobject with the field of view cannot see another gameobject hiding behind that wall. The field of view is a gameobject. Could I use the view of the camera and convert it into an actual gameobject that can detect collisions?

Also thanks for the honesty :) Do you have a better suggestion?

avatar image Nazirzadeh isteffy · May 13, 2016 at 07:29 PM 1
Share

you can use raycast to notice if an object is in the field of view.

http://forum.unity3d.com/threads/raycasting-a-cone-ins$$anonymous$$d-of-single-ray.39426/

avatar image isteffy Nazirzadeh · May 14, 2016 at 07:09 AM 0
Share

Okay so in order for this to work, I would need to figure out a way to make the camera's field of vision something that can be literally seen by the player.

To change all of my field of views from a gameobject to a camera that casts visible field of vision that uses raycasts will take some time, so I will wait a little bit to see if someone can answer my question using purely colliding gameobjects.

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

72 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

Related Questions

Particle Collision causes Explosion?,Explosion on particle contact? 0 Answers

Make a Particle System play when Player gets destroyed 0 Answers

Add collision to mesh 0 Answers

Disable input while falling? 2 Answers

[SOLVED] Stop counting score code error! 1 Answer


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