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 thijser · May 06, 2015 at 10:16 AM · unity5vuforiaaugmented-reality

vuforia how to force objects into a 2D plane

I'm working on a game in which cards are placed on a table and then rendered in augmented reality. These objects have 3D physics attached to them which doesn't work as well if they are either rotated or if the system mistakes them for being higher or lower then they really are.

Is there a good method to force Vuforia/Unity to place all items in the same 2D plane and keep all of them upright compared to that plane?

I currently have the following code: using UnityEngine; using System.Collections;

 public class projectioncode : MonoBehaviour {
     Vector3 p1;
     Vector3 p2;
     Vector3 p3;
     Vector3 v1;
     Vector3 v2;
     Vector3 normal;
 
 
     /*
      *use a plane with the following 3 coordinates 
      */ 
     public void setPlaneByPoints(Vector3 point1,Vector3 point2, Vector3 point3){
         p1 = point1;
         p2 = point2;
         p3 = point3;
 
         v1=p2-p1;
         v2=p3-p1;
         normal=getNormal(v1,v2);
     }
 
     public Transform projectTransform(Transform input){
         input.position = projectPoint (input.position);
         return input;
     }
     /*
      *  projects a 3d point into space; 
      */
     Vector3 projectPoint(Vector3 point){
         Vector3 vOToPoint = point - p1;//vector between origin and point 
         float dist = Vector3.Dot (vOToPoint, normal); //distance plane to point 
         return point - dist * normal;
     }
 
     /*
      * caclulates the normal of 2 vectors
      */ 
     Vector3 getNormal(Vector3 v1,Vector3 v2){
         Vector3 res= (Vector3.Cross (v1, v2));
         res.Normalize();
         return res;
     }
 }
 
 which seems to kinda project objects into a plane but the results tend to be inaccurate and result in weird movements particular when moving the camera around. 

alt text alt text Maybe there is also a way to lock movement allong a given axis (note the camera can move).

rsz-tobetracked.png (91.9 kB)
rsz-tobetracked2.png (98.4 kB)
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 dullSword · Jul 28, 2016 at 01:20 PM

Man, I want to do the same. I want to make a game with 3D objects moves in a 2D plane to avoid the complexity of doing a true 3D project but still maintain some of the 3D aesthetics. Would appreciate any advice on this topic.

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

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

Cloud recognition in Vuforia 0 Answers

How can I make android app run with less than 20 fps 2 Answers

Black background issue in AR scene after adding Lightweight render pipeline effect. 2 Answers

How should I detect horizontal and vertical surfaces for AR? 1 Answer

How to turn real life object into gameobject 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