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 Default117 · Dec 07, 2011 at 11:45 PM · input3dtext

Detect word clicks on 3Dtext

Hey guys,

Im trying to work out how to write a system where the user can tap/click on a 3Dtext element and then detect which word was clicked on. I'm assuming there is no way of natively doing so. The only ideas i have so far is to attach a box collider, click on it, detect the hit.collider.ClosestPointOnBounds and work out relatively where the click was based on the amount of characters. Which would mean i need to read the characters, parse them to individual words and determine their seperate bounds. The issue with this is that each character has a different width, and it might also change depending on the distance from the camera.

Any suggestions of a way i could do this?

Another idea i have is to create an editor script where a designer can can type in a sentence, which then parses it into seperate words, giving a 3Dtext object for each word and attaching a seperate box collider per word and then just calling the parent "controller" when an individual word has been pressed.

Thanks

Comment
Add comment · Show 6
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 abritez · Jan 29, 2012 at 05:41 AM 0
Share

Did you ever find a way to go about this? Looking to experiment with some solutions over the next couple days.

avatar image Default117 · Jan 30, 2012 at 10:06 PM 0
Share

Hey. I ended up writing my own solution for this. I prototyped it just before christmas, so my memory on it is a little sketchy. But from what i could remember i wrote an editor window script that you can insert a string sentence to be printed on screen. The editor script then creates a series of 3DText elements to construct this sentence and space them out etc. The script also attaches a box collider on it and managed these words in an array with a second array with audio clips corrosponding to those words. When a word is tapped on the relative audio file is grabbed from the second array and then gets played and the text colour changed, a coroutine would keep track of the progress of playing the audio file and then change the text colour back to the original. Hope that helps.

avatar image abritez · Jan 31, 2012 at 03:55 AM 0
Share

Yeah actually that is how I was planning on going about it. I will give it a shot in a couple days, and see how it goes. Thanks

avatar image Default117 · Jan 31, 2012 at 04:32 AM 0
Share

No worries! Let me know how you guy. I'll probably post an answer in the next few days to explain my solution a little better.

avatar image abritez · Feb 01, 2012 at 06:17 AM 0
Share

I updated my original question here http://answers.unity3d.com/questions/211325/clicking-on-individual-words-in-text-area.html Still haven't totally got it, but getting close. Would love to see how you went about it if you have time to post up your code.

Show more comments

0 Replies

· Add your reply
  • Sort: 

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Help In Making a SphereCast for 3D Tire! Working RayCast Script included! 0 Answers

New input system controller stops detecting on fully pressed trigger? 0 Answers

Input.GetMouseButton 2 Answers

Input System Can't Catch Event on Update 0 Answers

How to offset Input.Acceleration by 90 degrees 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