• 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 /
  • Help Room /
avatar image
0
Question by NorthStar79 · Nov 17, 2017 at 09:13 AM · opencvsuggestionsgrids

I need your suggestions about how to approach this problem

Hello all, I know the title does not say much about my question but thanks for reading this far.

We are making a game that players try to create same (maybe almost same) image that we provide them before with some colourfull cards.

For example, lets say we give 5 cards to player and ask them to create this image with them alt text

How can we control if the player placed the cards in right order?

I am thinking some sort of grid system but things get complicated too quickly with a grid system. maybe I can try to use some kind of image recognizing to check if player created the right image (maybe with Open cv ?) but I 've never done it before. So what is your suggestion?

referance.png (4.5 kB)
Comment
Add comment · Show 5
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 Blue-Cut · Nov 17, 2017 at 10:22 AM 1
Share

Hi, I don't have any full solution to do this, just an idea to investigate: did you think about Raycast ? Unity provide Raycast functions that allow you to know what is the "first" collider touch by the ray: https://docs.unity3d.com/ScriptReference/Physics.Raycast.html

avatar image NorthStar79 Blue-Cut · Nov 17, 2017 at 10:44 AM 0
Share

raycast is the first thing that came to my $$anonymous$$d it first. and its still a viable way to go in fact, thanks for the suggestion.

avatar image Hellium · Nov 17, 2017 at 10:26 AM 1
Share

Why don't you just compare the SiblingIndex of the cards placed by the player and compare them to the order you gave when building the "pattern"?

avatar image NorthStar79 Hellium · Nov 17, 2017 at 10:47 AM 0
Share

good mention, could be viable way to go if its mixed with some basic grid system. thanks

avatar image Hellium NorthStar79 · Nov 17, 2017 at 12:10 PM 0
Share

The grid system may not be necessary, just compare the distance between the card in the pattern and the card placed by the player.

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by IgorAherne · Nov 17, 2017 at 11:54 AM

Yes, grid system would be required here, to verify the cards are placed in the correct locations


How can we control if the player placed the cards in right order? It's simple, - no need for openCV hahahah

structure:

Recall, when working with UI elements (children of Canvas), they are drawn top down

  - Canvas
 ----ImageA
 ----ImageB
 --------ImageX
 ----ImageC

The order in which unity draws them is A, B, X, C


As user places cards, parent them under canvas. Once user placed all cards, compare if it matches with intended hierarchy (A, B, X, C) etc


non-ui visualization: if you are dealing with more complex thing (non-UI), to visualize them you can also look into shader draw order. However, comparing with hierarchy structure to see if player won the game would still be a must.

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
avatar image
1

Answer by Zodiarc · Nov 17, 2017 at 03:21 PM

As for the order problem:

Use an ortographic camera, for every card the player places increase the Z position value for the next card. After all cards are placed you can check the z values with the z values of the correct solution. Due to higher z values the card overlap will also be correct.

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

73 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 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 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 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

AR face Augmentation in Unity 0 Answers

Issue with WorldToCell and Tilemaps. 0 Answers

computer vision (openCV) to create / control 2D - colliders....? 0 Answers

MonoDevelop suggestions framework/references 0 Answers

weird results when using RGBToHSV 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