• 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 /
This question was closed Sep 11, 2012 at 07:23 AM by zerox911 for the following reason:

The question is answered, right answer was accepted

avatar image
2
Question by zerox911 · Sep 05, 2012 at 02:09 AM · augmented realitytouch screen

does anyone here knows AR(augmented reality)??

here i have a project going on.. its an AR project on TOUCH SCREEN MOBILE DEVICES(phones and tablets with cameras).

example :

http://www.youtube.com/watch?v=y1zMiyJ34vc&playnext=1&list=PLA2A5852D66C31396&feature=results_main

as seen in this video.. the animation is seen in the device as a normal AR scene.. and the animation rotates when the TEMPLATE(the card, or any other object is being set to trigger it)..

what i want to do is.. instead of rotating the template.. i want to rotate my animation from the device itself..

can this be done..?? if so.. please guide me...

thank you for your patience..

Comment
Add comment · Show 17
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 AlucardJay · Sep 05, 2012 at 06:35 AM 0
Share

Upvote for excellent and unique question, and introducing me to a type of development I hadn't considered.

avatar image zerox911 · Sep 05, 2012 at 07:00 AM 0
Share

yes.. and i welcome u for that..

so.. my big question here is how to create a script to use it with finger gesture like pinching(zoom), dragging(rotate) and what not..

avatar image purplelilgirl · Sep 05, 2012 at 07:03 AM 1
Share

do you want to roll your own code or buy someone else'? spk on the forums wrote code for a couple of finger gestures, such as drag, pinch, twist etc. http://forum.unity3d.com/threads/95983-RELEASED-FingerGestures-Robust-input-gestures-at-your-fingertips!

avatar image AlucardJay · Sep 05, 2012 at 07:07 AM 1
Share

I havn't downloaded the SD$$anonymous$$ yet, but just watching the Vuforia video, they actually move the $$anonymous$$pot from the 'tile' by touching the screen and raycast screen point to world, then the model moves and retains its relationship to the parent 'tile' when the camera moves. It's all looking quite easy to implement (of course they make it look easy, but both videos I watched are developed in Unity). So my question would be : are you using the Qualcomm Vuforia system to implement AR, or using another product. I shall be playing around with the SD$$anonymous$$ this afternoon, and if the whole process (inc registration, getting the 'tile' image sheets in print and data form, implementation, etc) is done well and non-intrusive, I'll post back on my results for moving, rotating, scaling.

You know how to use Input.touches, right?

avatar image purplelilgirl · Sep 05, 2012 at 07:16 AM 0
Share

I tried Vuforia, it's pretty easy to use :)

avatar image AlucardJay · Sep 05, 2012 at 07:19 AM 1
Share

Yeah, looks like that is true. It's hard not to get excited watching these video's!

Regarding Input.touches and code : That's why I asked if you have already built to iOS / Android (I'm in iOS). I have a few answers here I can link to covering Input.touches if you have not and are developing for iOS (they are just a small extension from the Unity API, so just the basics) =]

Wait until I download, or if you already have, just look at the $$anonymous$$pot example (if it's there).

This is the video I mentioned that showed the fellow moving the $$anonymous$$pot by touching and dragging on the screen :

https://developer.qualcomm.com/mobile-development/mobile-technologies/augmented-reality/videos

Scroll down to : AR Tutorials/Workshops : then watch the first one : Tutorial: Qualcomm's Augemented Reality SD$$anonymous$$ / July 2011

avatar image zerox911 · Sep 05, 2012 at 07:23 AM 1
Share

exactly...

but the thing is.. how to implement the finger gesture without buying it..

i've already got scripts to drag, zoom and rotate... and its not AR..

its for touch screen devices that has built-in camera... and supports android and IOS..

*my brain hurts..

avatar image zerox911 · Sep 05, 2012 at 08:04 AM 1
Share

@alucardj and @purplelilgirl...

please let me know if you got any information or source scripting..

thank you for your kindness of helping..

avatar image purplelilgirl · Sep 05, 2012 at 08:35 AM 0
Share

nice, I rolled out my own code for that too, since I'm too poor/stingy to buy ready-made solutions, so need scripts? or you want to figure it out on your own?

avatar image fafase · Sep 05, 2012 at 08:58 AM 0
Share

I do not know if it has been said already but the book "Holistic program$$anonymous$$g with Unity", Penny de Byl has an introduction to AR. (I do not know the author and am not related to the book in any manner).

avatar image Fattie · Sep 05, 2012 at 09:07 AM 0
Share

heh fantastic title, did not know about it! :)

avatar image fafase · Sep 05, 2012 at 09:11 AM 0
Share

It is actually Holistic Game Development with Unity. The book has some real good parts and some...less real good ones. But it has an introduction on AR like simply adding a cube on top of a camera capture and something about a GPS also (can't recall what exactly...).

avatar image zerox911 · Sep 05, 2012 at 09:56 AM 0
Share

@purplelilgirl... any help will do... and yes.. i do need the scripts.. i'll figure it how based on the script.. thanks..

@Fattie .. well.. so did i.. and its really new..

avatar image purplelilgirl · Sep 05, 2012 at 10:13 AM 1
Share

@zerox911

I got this script somewhere in the forums: Gestures.js, I based my code on this code (sorry I don't know how to format this >.<)

var panTranslate : Vector3 = Vector3.zero; var distance : float = 5.0;

/ vars used to track camera rotation /

var rotation : Quaternion; var position : Vector3; var x : float; var y : float;

var zoomSpeed : float; var speedFactor : float;

function LateUpdate () { / do other stuff /

 /* zoom in/out for two finger pinch */

 if ( Input.touchCount == 2 ) {

     var firstFinger   =  Input.GetTouch(0);
     var secondFinger  =  Input.GetTouch(1);

     var currentDist   =  firstFinger.position - secondFinger.position;

     var deltaOne      =  firstFinger.position  - firstFinger.deltaPosition;
     var deltaTwo      =  secondFinger.position - secondFinger.deltaPosition;

     var lastDistance  =  deltaOne - deltaTwo;

     var deltaDist     =  currentDist.magnitude - lastDistance.magnitude;

     distance -= (deltaDist * Time.deltaTime) * zoomSpeed * $$anonymous$$athf.Abs(distance); 

     /* clamp the distance so you can't get too close or far */

     //distance   =  clampDistance (distance, distance$$anonymous$$inLimit, distance$$anonymous$$axLimit);
 }

 /* pan for three touches */

 if ( Input.touchCount == 3 ) {

     var total$$anonymous$$ovement = Vector2.zero;

     for ( var thisTouch : Touch in Input.touches ) {
         total$$anonymous$$ovement += thisTouch.deltaPosition;
     }

     var pan$$anonymous$$ovement = total$$anonymous$$ovement / Input.touchCount;

     var deltaPanY  =  pan$$anonymous$$ovement.y * transform.up    * distance * speedFactor;
     var deltaPanX  =  pan$$anonymous$$ovement.x * transform.right * distance * speedFactor;

     panTranslate  -=  deltaPanY;
     panTranslate  -=  deltaPanX;

     /* clamp the pan vector to constrain movement */

     //panTranslate = clampPanTranslate(panTranslate);
 }

 /* ignore rotation for this example... */

/** rotation = Quaternion.Euler(y, x, 0); position = rotation * Vector3(0.0, 0.0, -distance) + target.position + panTranslate;

 transform.rotation = rotation;
 transform.position = position;
 **/

}

avatar image zerox911 · Sep 05, 2012 at 10:20 AM 0
Share

well... im gonna give it a try...

thanks.. if it didn't work.. im not bla$$anonymous$$g u...

^__^

avatar image AlucardJay · Sep 05, 2012 at 10:35 AM 1
Share

Here are some links from the Unify Community 'site :

http://wiki.unity3d.com/index.php/Basic_iOs_Input_Tutorial

these two are JS for rotate, and have youtube links at the bottom (working script at bottom of page too) :

http://www.revelopment.co.uk/tutorials/unitytutorials/73-howtorota$$anonymous$$nobjectbytouch

http://forum.unity3d.com/threads/17382-Click-n-drag-iphone

All the other Unify Community scripts are in C#, but this is the one I learned from :

http://wiki.unity3d.com/index.php/Tap_to_$$anonymous$$ove_Drag_to_Look_iPhone

C# for reference :

http://wiki.unity3d.com/index.php/Finger$$anonymous$$anager

http://wiki.unity3d.com/index.php/DetectTouch$$anonymous$$ovement

http://wiki.unity3d.com/index.php/TouchLook

I have something I wrote for scaling if one of the pros don't provide a better structured answer first =]

Edit : Also check my answer here to rotate an object (JS) :

http://answers.unity3d.com/questions/289055/rotate-on-drag-for-ios.html

It seems like this question has turned from AR to iOS input !

avatar image zerox911 · Sep 05, 2012 at 10:41 AM 0
Share

thanks @alucardj... i'll check on it..

1 Reply

  • Sort: 
avatar image
2
Best Answer

Answer by purplelilgirl · Sep 05, 2012 at 02:21 AM

Yes, it can be done.

Try looking into Qualcomm's Vuforia: http://www.qualcomm.com/solutions/augmented-reality

They have sample projects on AR using Unity and Vuforia.

Comment
Add comment · Show 11 · 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 zerox911 · Sep 05, 2012 at 02:24 AM 0
Share

i see.. thanks ... ^__^

your help is kindly appreciated..

avatar image zerox911 · Sep 05, 2012 at 02:53 AM 1
Share

i'll accept it when i've found a solution.. fair enough??

:P

avatar image AlucardJay · Sep 05, 2012 at 06:34 AM 1
Share

Upvote just for sharing an amazing link. Watching the SD$$anonymous$$ video now and imagining all that could be done with this. Thanks =]

avatar image Fattie · Sep 05, 2012 at 08:15 AM 1
Share

it's AR excitement !! i wonder what the best-selling and coolest AR -related app is on the app store? there are many .. perhaps you should check 'em out, Alu?

avatar image zerox911 · Sep 10, 2012 at 07:58 AM 1
Share

well i did what ive promised..

ive found the solution..

so its thanks to u.. and the others..

^__^

Show more comments

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

11 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

Related Questions

AR foundation on raspberry pi? 0 Answers

DrawMeshInstancedIndirect not working in Hololens2 1 Answer

Clicking an Object on IPAD when within a Certain Distance 0 Answers

TouchScreen 3 Answers

Control camera with touch field for mobile game 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