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 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 this. I'm working on something liike this:

alt text

Imagine this... i draw a circle on swipe, but i want an efect after this. The way I'm thinking 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 this:

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 think? Is this a good aproach? Can someone tell me if there is a better way to do this. I'm also think of doing squares, triangles and other figures.

Note: I dont have money to buy assets and if this turns out any good i'll share it for free on asset store since i couldn't find anything similar to this 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.washington.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 thing 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 this 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 this 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, things get a little more tricky. You might have to detect straight line segments using something 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 something similar to your block approach, where you mark which tiles belong to the "triangle" and give success if a minimum percentage of those is destroyed. This 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

Thank you for the help. I can't upvote because I don't have 15 reputation yet.

avatar image noio · Aug 01, 2014 at 05:49 PM 0
Share

If you like/use it you can 'accept' it :)

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

Objectives based on object appear. 2 Answers

object move in three lanes 1 Answer

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

Connection between 2 scripts 1 Answer

Multiple Cars not working 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