Duplicate Question
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.
"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!
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.
I did research on this subject and came up with nothing thank you
@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.
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:
Check if the left mouse button is pressed - Input.GetMouseButtonDown(0)
Get the current screen position of the mouse - Input.mousePosition
Get a ray pointing away from the camera through that point - Camera.ScreenPointToRay
Use ray data to do a physics raycast- Physics.Raycast
Check if the interactable object washit by the raycast
transition logic
yes that is what I'm saying but I'm fairly new and do not know how to write the code for this
Follow this Question
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