Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
This question was closed Apr 04, 2016 at 04:33 PM by meat5000 for the following reason:

Duplicate Question

avatar image
0
Question by TSCGCobra043 · Apr 04, 2016 at 03:51 PM · mechanics

How to interact with an object? (character)

I'm trying to make it so that the player can left click with the mouse on a box collider and it will transition to another word. I know how to set it so that it will transition to the world when clicked but I do not know how to make it so the player can left click on the collider.

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 NonBreaker · Apr 04, 2016 at 04:21 PM 0
Share

"it will transition to another word."

Could you elaborate on what you mean by this? I'm thinking a full description of what you're actually trying to do (in less technical terms) will give a clearer picture of how to help. Thanks!

avatar image meat5000 ♦ · Apr 04, 2016 at 04:32 PM -1
Share

You should really check out the Tutorial Section through the Learn link above.

You should conduct research and searches before posting such questions. This has been handled extensively on UA and around the internet already. It is expected to show what you have attempted for yourself before you ask for someone to do it for you.

https://www.google.co.uk/search?q=unity+click+an+object&ie=utf-8&oe=utf-8&client=ubuntu&channel=fs&gfe_rd=cr&ei=GpcCV6SuJejW8geUj5HACA&gws_rd=ssl

avatar image TSCGCobra043 meat5000 ♦ · Apr 04, 2016 at 04:48 PM 0
Share

I did research on this subject and came up with nothing thank you

avatar image crohr meat5000 ♦ · Apr 04, 2016 at 06:06 PM 0
Share

@meat5000 in the future I would suggest showing a bit more understanding for new members. There are a lot of resources out there new users have access to, but not everyone will inherently know where to find these resources. Especially people who are new to program$$anonymous$$g in general.

1 Reply

  • Sort: 
avatar image
0
Best Answer

Answer by crohr · Apr 04, 2016 at 04:29 PM

I believe what you are saying that you need to determine if the player is left clicking on an object in world space, correct me if I am wrong? To do this:

  1. Check if the left mouse button is pressed - Input.GetMouseButtonDown(0)

  2. Get the current screen position of the mouse - Input.mousePosition

  3. Get a ray pointing away from the camera through that point - Camera.ScreenPointToRay

  4. Use ray data to do a physics raycast- Physics.Raycast

  5. Check if the interactable object washit by the raycast

  6. transition logic

Comment
Add comment · Show 2 · 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 TSCGCobra043 · Apr 04, 2016 at 04:47 PM 0
Share

yes that is what I'm saying but I'm fairly new and do not know how to write the code for this

avatar image crohr TSCGCobra043 · Apr 04, 2016 at 06:01 PM 0
Share

Cool, yea the post that meat5000 linked outlines the basics of what you trying to do. Here is the direct link to a post that has the code. But definitely do look into the video tutorials & live training under learn. This resources are very useful for learning the basics and beyond.

Follow this Question

Answers Answers and Comments

57 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 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Defining Rectangles on the fly 1 Answer

I need to bend a stick and am lost 1 Answer

boomerang System(3d top view ) 0 Answers

How do I maintain the same X and Y coordinates when changing scenes? 1 Answer

How to make a formula or percentage armor which depends on player level and player armor? 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