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 kjuuz · Jan 16, 2014 at 09:52 AM · texturepositionclick

Gui or texture (ex. circle) on plane by click

Hi there!

I have character who is been moving by ClickToMove script and i searched around the web and pretty much on Unity Answers and doc. And i couldn't find anything that works for me.

So, i wanna create ar circle (2d texture or some simple black point - dont care)... leave a mark on clicked position, when player moves to position the circle disapears..

I dont want to someone code the script for me, but i would be very happy to give me some direction to look at. LineRenderer i think wouldn't be the right thing or just i have no idea how to use it in this situation, also tried projector - no success.

Ideal for my case would be : click > show texture > character reach destination > remove texture. The thing is - I dont know how to show that texture on plane. Can someone suggest something for me?

Perfect would be c# example.

Thanks. Sorry about english

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
0
Best Answer

Answer by nesis · Jan 16, 2014 at 10:05 AM

Rather than using a texture, you might be better off using either a projector or a mesh, and placing them so they're just above the ground. To get where the user clicked in C#, you'd do this in its Update() function:

 public Transform indicator;
 
 public void Update() {
     if (Input.GetMouseButtonDown(0)) {
         const float offset = 0.1f; //set this to whatever offset from the surface you want
         Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
         RaycastHit hit;
         if (Physics.Raycast(ray,out hit, Mathf.Infinity)) {
             indicator.position = hit.point + hit.normal * offset;
             
             //alternatively, offset it upwards, depending on what you want
             //indicator.position = hit.point + Vector3.up * offset;
         }
     }
 }

Then for the indicator, you'd just need to, say, show it when it's beyond some distance from the player.

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 kjuuz · Jan 17, 2014 at 05:30 PM 0
Share

Thank you very much for the answer!

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

19 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

Related Questions

How to get texture coordinates without using MeshCollider? 0 Answers

So here is some really complicated question. 1 Answer

Dynamically changing a decals position on a mesh surface 2 Answers

How to make the Health bar on Enemys head not be in relation to Player(main) Camera? 2 Answers

Assigning UV Map to model at runtime 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