Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 AcroYogi · Sep 22, 2011 at 03:23 PM · iphonemultitouchiphoneinputtuio

porting MouseDown to iPhoneInput.Touch and/or uniTUIO events

Hi, I've built a complete Unity app that works great for mouse. Now I'm trying to port it to multi-touch using uniTUIO, for use on an actual multi-touch table.

What I'd like to do is to simply replace these calls:

 if (Input.GetMouseButtonDown(0)) {}
 else if (Input.GetMouseButton(0)) {}
 else if (Input.GetMouseButtonUp(0)) {}

with these calls:

 if (iPhoneInput.touchCount > 0 && iPhoneInput.GetTouch(0).phase == iPhoneTouchPhase.Began) {}
 else if (iPhoneInput.touchCount > 0 && iPhoneInput.GetTouch(0).phase == iPhoneTouchPhase.Moved) {}
 else if (iPhoneInput.touchCount > 0 && iPhoneInput.GetTouch(0).phase == iPhoneTouchPhase.Ended) {}

I know this implementation isn't true multi-touch... that's the next step. For now, I just want my app to work with TUIO... and specifically uniTUIO, which appears to get mult-touch working by emulating iPhone touch events within its code.

The problem I'm experiencing is that my main script, which is attached to the Main Camera, is not receiving any of the iPhoneInput signals that uniTUIO is purportedly generating.

As a test I attached the uniTUIO supplied BBTouchableButton script to a few game objects, and designated Main Camera as the Notification Object. Sure enough, that properly triggered the doTouchDown() and doTouchUp() functions in my Main Camera script when the afroementioned gameObjects were touched. So uniTUIO is working at SOME level...

just need some guidance on getting the actual iPhoneTouch events to propagate globally...

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by MatthewAtMcK · Oct 03, 2011 at 12:12 PM

I am trying to work on a similar thing as far as I can tell so hopefully I can help you.

First things first, you need a TUIOStarter prefab with some scripts attached. These scripts are BBTouchManagerStarter (BBIPhoneTouchManager needs to be attached to this on the Event Manager Prefab slot) and for helping with testing, BBCrosshairController. Then just drag the prefab in to your scene.

Then on any objects you want to be drag-able, you need some more scripts. You need BBBasicTouchManipulation and BBTouchableButton. Included in the former script is a line which sends a message when the touch is down and another when the touch is up. So to have events on touch down, just create a function called "doTouchDown" in any of the scripts attached to the same object and the same for "doTouchUp"

Hope this helps and I did understand your problem correctly and good luck with the rest of it!

Matt

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 AcroYogi · Oct 04, 2011 at 06:15 PM 0
Share

Right, I've had those scripts in place for some time. There are hundreds of objects in each of my 4 scenes and I'd prefer not to have to manually attach scripts and parameters to each of them. Since my $$anonymous$$asterScript already detects for raycasts and deter$$anonymous$$es which gameObject gets hit from a mouseDown event, I'd like to simply iterate the same code for all active touchDowns / touch$$anonymous$$oves, and then let my master script deter$$anonymous$$e what is being hit and what needs to be done.

I'm trying right now to modify the CrosshairController script to use Send$$anonymous$$essage to post positional touch messages to my $$anonymous$$asterControl script. Will keep you updated!

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

Degree from point? 2 Answers

uniTUIO touch delay 0 Answers

Multitouch iPhone error! Help 1 Answer

Attaching Scripts to GUI Components 1 Answer

Can I update a scene's position and rotation on iPhone using a custom class? 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