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 /
This question was closed Dec 09, 2012 at 01:09 AM by Dexter.Unity for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by Dexter.Unity · Oct 26, 2012 at 11:56 PM · coordinatesonclick

How can i get the coordinates of the point on an object I click on?

Hi all,

I am new to this so I hope this question hassn't been asked before. I've tried finding it with google but no luck.

So I am trying to set the coordinates of an empty game object (a 'walkToPoint') to which my character has move when he walks.

What I would like to know is how to get the coordinates of the point on the object 'a plane' (and eventually terrain) i click on.

========================

Solved =)

========================

This is what I eventually used (for those who have the same question) :

 var camera3rd     : Camera;
 var walkToPoint    : Transform;
 
 function OnMouseDown()
 {
     var hit    : RaycastHit;
     var ray    : Ray = camera3rd.ScreenPointToRay (Input.mousePosition);
     
     // Cast a ray, get its hit coördinates, set it to the walkToPoint
     if(Physics.Raycast(ray.origin, ray.direction, hit)){walkToPoint.transform.position = hit.point;}
     
     
     // Draw a Yellow colored ray
     // Debug.DrawRay (ray.origin, ray.direction * 50, Color.yellow);
 }
 
 
 
 

camera3rd = my 3rd person camera (the camera you are using to look with)

walkToPoint = A point in space my character has to walk to.

Comment
Add comment · Show 1
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 Fattie · Oct 27, 2012 at 09:25 AM 0
Share

once you are an expert on this, here is a massive discussion on the details of the matter

http://answers.unity3d.com/questions/292333/how-to-calculate-swipe-speed-on-ios.html

1 Reply

  • Sort: 
avatar image
0
Best Answer

Answer by hvilela · Oct 26, 2012 at 11:56 PM

Check Raycast.

Comment
Add comment · 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

Follow this Question

Answers Answers and Comments

11 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

Related Questions

How to have a Boolean check as true after multiple other Booleans are marked true 2 Answers

How to get mouse position in World Space when in Editor Mode 1 Answer

How to spawn object next to other object? 3 Answers

unity gameobject to sprite (UI Image) 1 Answer

store positional data into a csv file 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