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 eduardord · Sep 23, 2014 at 09:19 PM · cameraresolutiondeployment

ScreenToWorldPoint not working properly on deployment

I am trying to make a ship move to a touch point. I get the Vector2 position of the touch, then convert it to world coordinates and then move the ship to that position. It is working properly on the Unity editor, however if i deploy it to a Windows Phone 8.1 (Lumia 1520) The screen coordinates are reduced: These are the coordinates on the PC with the respective value that Im getting on the phone:
Bottom Left Corner -> PC: (0,0) Phone (0, 639) which is like 1/3 of the screen up from the corner Bottom Right Corner ->PC: (525, 0)Phone (720, 639).
Camera is Orthographic, Native and Preview Resolution are 1080x1920
And here is the code to process the touch point: void OnMultiTap(Tap tap){ Vector3 tapPos = Camera.main.ScreenToWorldPoint(new Vector3(tap.pos.x,tap.pos.y, -1000)); tapPos.z = 0; iTween.MoveTo(gameObject, iTween.Hash("position", tapPos, "time", 1 ); Debug.Log (Screen.width + " h: " + Screen.height); Debug.Log (tap.pos + " v3 " + tapPos); }

My camera is -1000 units in the back, thats why I set that Z value, then change it to 0 for the ship only to move in 2 dimensions.
Any help is appreciated! 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 robertbu · Sep 23, 2014 at 09:21 PM 1
Share

I don't understand your -1000. For ScreenToWorldPoint(), the 'z' value should always be the positive distance in front of the camera for a perspective camera.

avatar image eduardord · Sep 23, 2014 at 09:26 PM 0
Share

$$anonymous$$y Camera is placed on (0,0,-1000) and its orthographic, do you think that if i move it to (0,0,1000) and set the ScreenToWorldPoint Z value positive will fix it?

avatar image Freaking-Pingo · Sep 23, 2014 at 09:33 PM 0
Share

Are you by any chance using Unity Remote for testing? I have experienced issues with touch being dislocated when using Unity Remote.

avatar image eduardord · Sep 23, 2014 at 09:39 PM 0
Share

Nope, im just exporting a Solution file for windows phone 8, then upgraded it through visual studio to 8.1

avatar image Freaking-Pingo · Sep 23, 2014 at 10:20 PM 0
Share

Could you pleas post the code, for the way you access your touch coordinates?

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Keep Aspect ratio/Letterbox and maintain pixel perfection 0 Answers

First Person Camera Pixelation 1 Answer

Camera horizontal distortion? 1 Answer

Build camera problems... 0 Answers

AR plugin operating at native camera resolution 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