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
1
Question by stblue · Mar 05, 2014 at 05:42 AM · androidunity-androidcoordinate-system

Mismatch cordinate system of unity and android

I am new to unity3d, Right now i am adding a cube as game object with coordinate 0,0,0 But when i run it on android device Iam facing 2 problem a) Coordinate system of unity3d are different from coordinate system of device, For device top left is 0,0 but for unity center of the screen is 0,0. How to fix that mismatch or i need to multiply with some factor to make it work.

b) Iam moving the object on x-axis this is what iam doing for moving object on x-axis

  if(xback){
      xaxis+=(2*Time.deltaTime);
      if(xaxis >Screen.width/2){
       xback = false;
       }
      }
 else if(!xback){ 
      xaxis-=(2*Time.deltaTime);
      if(xaxis<=-(Screen.width/2)){
       xback = true;
   }
  }

 Vector2 temp = transform.position; 
 temp.x = xaxis;
 temp.y = yaxis; 
 transform.position = temp;

But the problem iam facing is as soon as my xaxis equals 9 it touches the right of screen and then it get out of screen, so iam little bit confuse is unity3d pixel system is different from the one on device, because iam moving the cube by one pixel every time but movement is not equal to 1 pixel of device. so i want to know is pixel system of unity is different from pixel system of android or iam doing something wrong.

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 robertbu · Mar 05, 2014 at 05:47 AM 0
Share

Objects live in world space...a 3D environment. $$anonymous$$ouse and touch live in Screen space which is a 2D environment that goes from (0,0) in the lower left corner to (Screen.width, Screen.height) in the upper right corner. There are a variety of methods and tools to convert between the two. Research in the reference and on UA

  • Camera.ScreenPointToRay()

  • Camera.ScreenPointToWorldPoint()

  • Physics.Raycast().

  • Plane.Raycast()

Also note that the center of the screen in world space is only (0,0) because the camera happens to be pointed towards the origin by default.

avatar image stblue · Mar 05, 2014 at 05:58 AM 0
Share

@robertu thanks for replying i will look at function suggested by you.

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

20 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

Related Questions

Android Crashes on game load 1 Answer

AndroidJavaProxy no such method exception,AndroidJavaProxy no such proxy method error 2 Answers

Issue with Tap Control Setup for Android 0 Answers

Reading NFC Tags on Android 0 Answers

How to prevent Android from killing my Unity app ? 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