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 Goss · Aug 22, 2013 at 04:39 PM · c#multiplayer-networkingtouchscreenworldspacescreenspace

World and Screen space Multiplayer[Touch Screens]

I have two touch monitors that I want to sync over a network. A user can drag an object by touching the screen. Whenever a user touches the screen, an icon appears there. I need to notify other users over the network when a user touches the screen. However, both users can be looking at different parts of the world. Meaning that if I'm not looking at the same location as another user, then I won't see when they are touching the screen.

I tried ScreentoWorldPoint values over the network and the receiving user transform it back to WorldtoScreenPoint. However, it only works if they are looking at the exact same location.

Comment
Add comment · Show 3
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 Benproductions1 · Aug 22, 2013 at 11:09 PM 0
Share

On one side calculate the world point that the user is clicking, on the other side convert that world point back to screen space and put the icon there

avatar image Goss · Aug 23, 2013 at 01:02 AM 0
Share

I tried that and it doesn't work like you think it might. Only if both clients have their camera in the exact location.

avatar image Benproductions1 · Aug 23, 2013 at 01:07 AM 0
Share

It works no matter where the cameras are, unless you implemented it incorrectly

It does work like I think it does, because I have done it that way before :)

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by meat5000 · Aug 23, 2013 at 01:13 AM

Converting WorldtoScreen space will calculate the world to YOUR screen and not the screen the touch was made on!

When you touch the screen you can find the distance to the game world underneath the touch with Raycast.

Feed the world position, touch ray direction vector and distance into intermediate storage variables. Pass these variables to the other device and use them to reverse calculate where the other screen is located. The actual screen touch position is not useful as, if you think of it, looking out of the world to the back of the screen, the screen would be massive.

Simply use the world position and the direction vector of the ray (reversed) from the other devices Screen to World touch to draw your line the same distance as the ray. Place your icon there.

Your line will assume the touch came from the centre of the other screen and the icon will move as the ray changes. Make it a Finger icon and you are set :P

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 Goss · Aug 23, 2013 at 02:18 PM 0
Share

Thanks! I will try that.

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

17 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

Related Questions

Fitting GOs from world point to screen space UI. 1 Answer

Zoom in on tapped point in 3D space 1 Answer

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

C# change an object tag wit raycasthit. 2 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