Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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
1
Question by MonicaPonciano · Oct 23, 2014 at 07:55 PM · instantiatevuforiacoordinatesgps

How to instantiate an object at GPS coordinate?

Hi folks,

I would like to instantiate an object at some given coordinate. For example, I have GPS coordinates of my house and I would like to place an object at that location, then i would like to know if I'm near the object (unity renders the object close to the camera) or far (renders the object away to the camera - or invisible).

How can i do that?

(I'm also using vuforia for AR Camera)

Comment
Add comment · Show 2
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 crockman1 · May 27, 2017 at 01:56 AM 0
Share

yeah how to do this I wonder

avatar image Clem46 · May 27, 2017 at 08:56 PM 0
Share

hi if you would like instantiate object on gps position you need :

public Transform GPSPos; public GameObject TheObject;

void Update(){

Instantiate(TheObject, GPSPos.position, GPSPos.rotation);

}

3 Replies

· Add your reply
  • Sort: 
avatar image
-1

Answer by crockman1 · May 27, 2017 at 08:42 AM

yeah how to do this I wonder

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

Answer by DiGiaCom-Tech · May 27, 2017 at 09:18 PM

Convert the GPS coordinates into X/Z values (you can set the Y value based on the get terrain height at X/Z). Basically 1° degree Latitude/Longitude at the equator is approximately 111 Kilometers (111,000 meters). The math to convert Degrees° Minutes' Seconds" values to decimal meters is rather straight forward. Take a look at these links...

https://www.google.com/?gws_rd=ssl#q=meters+per+degree+latitude&spf=1495919126475

The problem you'll encounter is that GPS coordinates are spherical, that is, the farther North/South you get away from the equator the smaller the distances for X are (as they converge to a single point at the poles). The question you have to ask yourself is how BIG is the area you are working with? If a small area, then you really don't have to factor this compression in. If you are doing something that covers the whole globe then you'll have to do the math (remembering to factor in the diameter of your world).

Once you have the X/Y/Z values calculated the instantiation call is rather simple. Please let me know if you need assistance with that (your initial post was a little vague on what you were really asking for help with).

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 mradamjames · Jul 28, 2021 at 11:33 AM 0
Share

Wondering if this has been made any easier with MARS and AR+GPS plugins? Attempting something similar myself

avatar image
0

Answer by M1tiens · May 29, 2019 at 09:14 AM

I'm also struggling with this. I managed already to get x and z coordinates from a gps coordinate, but i think they are wrong because the don't regard the initial device rotation, or in other words, i think i'm getting the absolute value of the gps location, but if a place is like 10 meters away from my current place, i don't know if it's in the positive or in the negative side of the axis. @DiGiaCom-Tech can you help me with this?

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

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

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Cloud recognition in Vuforia 0 Answers

animations not change when OnGUI button click in unity3d Vuforia? 1 Answer

How can i get gps signal on my andriod without data or wifi 0 Answers

how to store the texture 1 Answer

GPS doesn't work in AGPS mode 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