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
1
Question by ExpiredIndexCard · Jul 05, 2013 at 12:53 AM · shadertagsystemwall

Spotting Enemies Like In Battlefield 3?

How do I make a tagging system where if the player pressed a button on an enemy, there would be a tag above his head that follows him? It should also show through walls and objects. How do I do something like this? Thanks

alt text

testcamerainspector.png (35.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

1 Reply

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

Answer by D4rt · Jul 05, 2013 at 01:11 AM

A big question, but I think I have the necessary components for you to get started.

1. Detect the mouse/button click on the object.

This is the easiest way for mouse clicks: http://docs.unity3d.com/Documentation/ScriptReference/MonoBehaviour.OnMouseDown.html

If you need it to be a keyboard button, you should use raycasting: http://docs.unity3d.com/Documentation/ScriptReference/Collider.Raycast.html http://docs.unity3d.com/Documentation/ScriptReference/Physics.Raycast.html

2. Create a floating tag

This is for displaying text in 3D space for the actual tag:
http://docs.unity3d.com/Documentation/Components/class-TextMesh.html

If the tag is only an image then you can just create a plane and add the texture to that.

You'd have to come up with a way to rotate the tag towards the camera (easiest way is to just copy the cameras rotation). Then just position it above the target players head (parenting is a good trick here). http://docs.unity3d.com/Documentation/ScriptReference/Transform-parent.html

3. Make the tag visible through other objects.

You'll need a new camera. Create a new layer and call it something like "Tag". Set the culling mask of the new camera only to "Tag". Set the layer of the actual tag to "Tag" as well. Parent the new camera to your main camera and make sure the position and rotation of the new camera are zero. Vóila.

EDIT: Couple things forgotten. The "Depth" of the new camera must be bigger than the "Depth" of the main camera. Also the "Clear Flags" of the new camera must be set to "Depth only".

Comment
Add comment · Show 7 · 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 ExpiredIndexCard · Jul 05, 2013 at 02:27 AM 0
Share

I wonder who down voted me. ... any ways, thanks for this answer

avatar image ExpiredIndexCard · Jul 05, 2013 at 04:51 AM 0
Share

The tag is not going through objects. I did everything you said to do. What's wrong?

avatar image D4rt · Jul 05, 2013 at 04:53 AM 0
Share

Hard to say. Have you tinkered with the camera depth? The tag cameras depth should be bigger than the main cameras

EDIT: If you give more information, for example what works and what doesn't and maybe a picture of your setup I could perhaps help more.

avatar image ExpiredIndexCard · Jul 05, 2013 at 04:59 AM 0
Share

Sure give me a $$anonymous$$ute

avatar image ExpiredIndexCard · Jul 05, 2013 at 05:02 AM 0
Share

I have tried adjusting the depth but when I do, I can't see anything anymore, just the skybox

Show more comments

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

16 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

Related Questions

Vuforia Follow Character In World 0 Answers

Is there any class, function, or variable available from a unity shader to get either system time or real time. 1 Answer

Creating a particle system that uses 1 draw call 0 Answers

How to create a tag like system. 1 Answer

is it possible to have two different passes in Shader 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