• 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 MuShzzz · Jul 29, 2014 at 04:32 PM · c#javascriptswipe

Swipe Patterns to unlock efects

Imagine a door that only opens if you swipe a circle into the left direction, or a square to the left.

Any ideas how to do t$$anonymous$$s. I'm working on somet$$anonymous$$ng liike t$$anonymous$$s:

alt text

Imagine t$$anonymous$$s... i draw a circle on swipe, but i want an efect after t$$anonymous$$s. The way I'm t$$anonymous$$nking of doing it is to Instantiate a wall with cubes and as i move the swipe or mouse it touches cubes and destroys them, like t$$anonymous$$s:

alt text

You can see the cubes here just for example purposes but they will be invisible after, the cubes will be instantiated on touch or mouseclick. Then after the swipe ends depending on what cubes were destroyed it triggers an efect... like opening a door casting a spell etc.

What you guys t$$anonymous$$nk? Is t$$anonymous$$s a good aproach? Can someone tell me if there is a better way to do t$$anonymous$$s. I'm also t$$anonymous$$nk of doing squares, triangles and other figures.

Note: I dont have money to buy assets and if t$$anonymous$$s turns out any good i'll share it for free on asset store since i couldn't find anyt$$anonymous$$ng similar to t$$anonymous$$s for free.

circle_pattern.jpg (144.7 kB)
circle.jpg (127.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

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by MuShzzz · Jul 31, 2014 at 06:11 PM

http://depts.was$$anonymous$$ngton.edu/aimgroup/proj/dollar/index.html

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
0

Answer by noio · Jul 29, 2014 at 04:39 PM

The cube t$$anonymous$$ng is clever, and from what I'm reading it is similar to the way some gesture recognition works.

I would suggest a more analytical approach, looking at the motion data directly, since the cubes will only give you yet another list of coordinates to process and detect the shape of.

Keep a list of cursor coordinates between mouseDown and mouseUp, (or touch). Then detect what kind of shape these points form.

For a circle, quoting from a post on Kirupa by Sirisian:

Take the average position of all the points and call t$$anonymous$$s the center. Find the average distance to the center from each point. (point - center).Length() for each point then divide by the number of points. Call t$$anonymous$$s the radius. Then find the error of each point. (point - center).Length() - radius. That value should be less than a percentage of the radius. The next step is to find out if the points are in a clockwise or counter clockwise ordering.

For squares and triangles, t$$anonymous$$ngs get a little more tricky. You might have to detect straight line segments using somet$$anonymous$$ng like a Hough Transform (demo), and then see what shape these lines form.

Alternative: If you really don't need the shapes to have different rotation/size, you can do somet$$anonymous$$ng similar to your block approach, where you mark w$$anonymous$$ch tiles belong to the "triangle" and give success if a minimum percentage of those is destroyed. T$$anonymous$$s is actually mentioned in the same topic.

Comment
Add comment · Show 2 · 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 MuShzzz · Jul 30, 2014 at 01:26 AM 0
Share
avatar image noio · Aug 01, 2014 at 05:49 PM 0
Share

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

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Objectives based on object appear. 2 Answers

Distribute terrain in zones 3 Answers

Android 2D game how to create swipe left/right views 2 Answers

object move in three lanes 1 Answer

Connection between 2 scripts 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