Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 Orggrim · Mar 06, 2013 at 07:40 AM · raycastshootingtransparencydowntop

See Through Objects in Top Down Shooter

Hi, I am currently creating a top down shooter game, one of the problems I seem to run into in my game is not being able to see the player if he goes underneath a piece of geometry(plane, cube, etc)

I was looking to see if there was a way to have it to where the player went behind one of these objects that it makes the object see through

I did a little research, and from what I gathered I would have to use a Raycast between my player and the camera, something like

Cast raycast from camera to player, if it hits player, do nothing, if it hits object, set opacity to 50% or something.

Any help or suggestions would be greatly appreciated!

Comment
Add comment · Show 4
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 Orggrim · Mar 06, 2013 at 08:08 AM 0
Share

haha glad to see that my brain somewhat works at 2am! now to do the fun job of learning syntax!!!

avatar image Orggrim · Mar 06, 2013 at 08:51 AM 0
Share

Couldnt I just set the texture to a Transparent/Bumped Diffuse shader and alter the Alpha via script?

avatar image FWCorey · Mar 06, 2013 at 11:05 AM 0
Share

That would work as well but increase draw calls more if there are a lot of instances in the scene.

avatar image Orggrim · Mar 06, 2013 at 10:06 PM 0
Share

Ok I got the raycast to output the line, but for some reason I cant get it to point to my player! It will follow the player as it moves around, but it seems like its offset by a huge margain.

Heres the code I have...


var target : Transform;

 function Update () 
 {
     
     Debug.DrawRay(transform.position,target.position,Color.green);
     
     if (Physics.Raycast(target.position, transform.position))
      {
         Debug.Log("Something in the way");
      }
 }


Here is an image representing what my problem looks like!

alt text

Let me know if there is anymore info you need!

2 Replies

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

Answer by FWCorey · Mar 06, 2013 at 07:51 AM

That's exactly what you need to do. There are several ways of doing the transparency and which way you choose to do it depends on your project. If there are very few objects that you would have to make transparent then the easiest is to have 2 materials for each. You would then place a script on each object that sets the transparent material for a short period of time when told and then sets it back. Your raycast script would use GameObject.SendMessage() to tell it to reset the timer as long as the rays keep hitting it. No fuss, no muss. :)

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 · Jan 04 at 06:20 PM

Hi If your still looking for a solution check our Asset as this is a custom made Asset 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/

Asset: https://assetstore.unity.com/packages/vfx/shaders/see-through-shader-193955

WebGL Demo: link text

Video: link text

Greetings Toorican alt text

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

12 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

Related Questions

headshot do not working with raycast? help! 3 Answers

Best way to shoot physical bullets? 2 Answers

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

having problems with my raycast shooting script 0 Answers

Making shooting function with RayCast iPhone 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