• 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 jessee03 · May 08, 2012 at 10:36 PM · arrays

slot machine

I have the basic concept on how to loop through an array of numbers to achieve a slot machine like effect but was hoping someone would know what would be the best way to setup the actually scrolling animation and being able to lock into a certain position when the reels stop just like real slot machines. So I'm basically trying to find out the best way to do a slot machine spinning reel animation that both looks and acts like a slot machine.

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
1
Best Answer

Answer by kolban · May 08, 2012 at 11:26 PM

There are probably many, many ways to achieve what you are looking for but the first one that comes to mind is to think of an individual spinner in the slot machine. This is basically a cylinder with (lets keep it simple) numbers on it. Lets imagine that there were 10 numbers on each spinner (keeping it simple). Since there are 360 degrees in a revolution, each number would occupy 36o of surface (360/10). Now, when you spin the spinner, it will rotate smoothly but ... it must come to a stop with its center axis of rotation evenly divisible by 36o. This will ensure that a "clean" number shows to the end user. If you have other than 10 numbers, change the math appropriately.

Comment
Add comment · Show 3 · 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 jessee03 · May 08, 2012 at 11:33 PM 0
Share

This sounds like a perfect way to achieve what I'm looking for. It just seems if I have 10 numbers in each row that the winning combinations code would get pretty crazy unless there's an easier way to do that as well besides a million if statements.

avatar image kolban · May 09, 2012 at 12:23 AM 0
Share

I'm sorry ... I guess I wasn't clear. I wasn't thinking 10 numbers on a row ... I was thinking 10 numbers around the circumference on ONE spinner ... with (typically) 3 or 4 spinners in a row.

avatar image princess · Jan 08, 2013 at 02:01 AM 0
Share

hi jessee03, i'm kinda new to unity + c#. I was wondering if you have script for the rotation with the stopping at the center axis of rotation evenly divisible by 360? if you don't, then it's fine. thanks. Great explanation, by the way.

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

9 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

transform array in javascript 2 Answers

problem accesing arrays 2 Answers

Multidimensional GameObject Arrays 1 Answer

Create a Word Game like Scrabble in Unity? 0 Answers

Creating an inventory/weapon array and ability to scroll through it 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