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 t-pedrob · Feb 02, 2014 at 06:48 PM · arraysortingcardarrange

Card arrangement

Hi guys, i have a problem. I have several cards in my hand, when a take one off the others must move one position to the left, anyone know any algorithm for this situation?

alt text

alt text

5.jpg (9.5 kB)
3.jpg (16.9 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
1
Best Answer

Answer by highpockets · Feb 02, 2014 at 07:23 PM

Just get the transform.position.x of the card that you are moving down. Then run a foreach statement to cycle through the array of cards and any card in the array that has a transform.position.x that is higher than the card that you moved has to move one space to the left with an immediate jump by just assigning a new transform.position or a nice even slide by using Lerp or Translate if you don't care about acceleration/deceleration ..

Hope that helps. If you don't understand something, let me know and I can give more details

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 moh05 · Dec 28, 2015 at 09:38 AM 0
Share

Hey, thanks for your reply :)

Just a different question, do you have any tips on how to arrange the cards in a circular way? Just like you hold it in real life. thanks in advance :)

avatar image highpockets · Dec 28, 2015 at 11:53 AM 0
Share

I think you should ask a new question with specifics. This would be helpful for someone else looking for the same kind of thing that you are. I would however suggest that you simply make an empty game object if there is no hand object and arrange the cards as child objects of the empty game object/hand object in the unity editor and just make a prefab of that. Then, if any cards replace the existing cards, you already have your positions and rotations of the existing cards, so just destroy or move the old one while saving the transform position and rotation and apply that info to the replacement cards transform. Hope that helps

avatar image moh05 highpockets · Dec 28, 2015 at 12:21 PM 0
Share

That was a great idea!!! thanks :)

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

Array Ordering 3 Answers

Trying to sort an array. What's wrong here? 1 Answer

Sorting an array of vectors in javascript 1 Answer

On which place is my value in array? 1 Answer

How unity arrange an Object's child ? 5 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