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 Kaemalux · Jun 04, 2014 at 11:16 PM · raycasttransparencyignore

Invisible objects between players and camera..

Hello! I have an issue with my 2d topdown rpg: id like to make invisible objects between player and camera, like roofs or secret passages.. I found this answer interesting, but i don't know if could really help me: http://answers.unity3d.com/questions/588271/hiding-objects-between-my-character-and-camera-how.html and i don't know how to setup the complete script.. Could anyone gently help me, by explanaing how to setup scripts and objects of that answer or suggesting other possible solutions? Sorry, i'm an unexperinced Unity user. :)

Thanks in advance!

Nic

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

4 Replies

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

Answer by blackcoper · Jun 05, 2014 at 07:08 AM

you can use collider for trigger. if player enter set roof invisible. when player leave set visible back.

Comment
Add comment · Show 1 · 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 Kaemalux · Jun 05, 2014 at 02:10 PM 0
Share

OH! So simple and so effective.... $$anonymous$$any many thanks blackcoper! ^_^

avatar image
2

Answer by Kiwasi · Jun 04, 2014 at 11:27 PM

Any object can be made invisible simply by removing or disabling its renderer component

Comment
Add comment · Show 1 · 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 Kaemalux · Jun 05, 2014 at 06:56 AM 0
Share

Thanks for your answer mate! But i actually need to make invisible objects between player and camera like roofs, but im not so expert in using raycast. :)

avatar image
1

Answer by ZodiaXCorpX · Nov 11, 2015 at 01:25 PM

Hello i have searched for this answer and i kept finding other idea's that are either complex ray-casting or resource heavy triggers. I have a simple solution for anyone that comes across this and im necroing an old post for the reason this comes up first in the search.

Create a box collider put it on your camera set rotation and position to 0 then on the Z axis streach it all the way to your player. Then add this script

Public void OnTriggerEnter(Collider other) { if(other.tag != "Player") { other.gameObject.getComponent().enabled = false; } }

Sorry for any spelling errors, This will turn OFF the renderer of any game object that comes between player and camera and its completely customizable with size since you can adjust the box collider to fit your needs :) This is C# and for the tag if your player is not tagged "Player" Or if you want to make exceptions just do this if(other.tag != "MyGuy" || other.tag != "DontDisableMyRenderer") ETC.

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
0

Answer by toorican · Dec 10, 2021 at 10:20 AM

Hi If your still looking for a solution check our Asset as this is custom made shader for this use case. It can handle multi user multi buildings ( obstructions ) and is available for Standard URP and HDRP .

https://forum.unity.com/threads/rel...isible-within-buildings-std-urp-hdrp.1182130/ https://assetstore.unity.com/packages/vfx/shaders/see-through-shader-193955 https://www.youtube.com/watch?v=9X9aVJzzBlI alt text


sts-172-splash.jpg (217.9 kB)
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

25 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

Related Questions

how to ignore transparency of image when clicking/raycasting on it in 2D/uGUI? 0 Answers

Change multiple object layers 0 Answers

Need raycast to target child, not parent. 0 Answers

Can't Ignore a Layer when raycat 0 Answers

layers not ignored by raycast 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