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 Vista13 · May 15, 2014 at 08:38 PM · physicsrigidbody

How to roll a cube

Hi everybody,

I am working on very simple project but i am stuck at what it seems very simple problem. What i need is to roll a cube like in this game:

https://www.youtube.com/watch?v=aml5FoyyKLo

Can somebody help?

Thanks

Comment
Add comment · Show 2
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 NoseKills · May 15, 2014 at 09:33 PM 0
Share

In almost any non physics based (no free movement, only a limited amount of "states"), grid based game i'd say the basis of the game is a 2D or 1D array where each index in the array corresponds to a coordinate/square on the game area.

It can for example be an int[] array where each value you assign to the array describes what is in that cell on the game area: the block you're rolling, the "level goal square", empty space or a slab onto which you can roll your cube.

Then make a class for the cube. The cube class must know it's orientation on the board and it must know which square(s) it will occupy after it makes the rotation based on your input.

With those 2, you could already have a playable prototype. Just set up a Quad to represent each square on the game area and change their colors based on their status (block/no block/empty/goal).

After you get the logic working, you can start to think about animating the block.

P.S. I know this has nothing to do with the question itself, but in this answer i wrote a working example of the type of grid system I'm suggesting. LIN$$anonymous$$

avatar image robertbu · May 19, 2014 at 09:49 AM 0
Share

I just answered a question that has code for rolling a cube. It may be a start on what you are looking for:

http://answers.unity3d.com/questions/710087/tipping-a-cube-over.html#answer-710471

0 Replies

· Add your reply
  • Sort: 

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

21 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

Related Questions

Advice for Intersecting Colliders 0 Answers

Unity Script causing crash 1 Answer

Rigidbody2D won't stop moving. 2 Answers

Addforce - bug with jump 2 Answers

controlling the center of mass for a car 2 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