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 jg2115 · Jul 25, 2013 at 01:24 AM · collisionrigidbodygravitycubefall

Making a cube fall without rigidbody

I am making a 3d puzzle game with blocks. Right now for gravity a I use rigidbody. The problem with this is that cubes push down on each other and look uneven. I have tried a seperate fall script but I don't know how to do the collisions to fall down to the closest cube below it and stop? I don't need a whole script, just suggestions.

Comment
Add comment · Show 6
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 Benproductions1 · Jul 25, 2013 at 01:35 AM 0
Share

What do you mean by "look uneven"? No real time physics can be fully accurate, so keep that in $$anonymous$$d :)

avatar image jg2115 · Jul 25, 2013 at 03:58 AM 0
Share

If you pick up a cube and place it again, it sinks past the other cubes a little bit. Here is a picture:

alt text

capture.png (423.7 kB)
avatar image Benproductions1 · Jul 25, 2013 at 04:00 AM 0
Share

How are you picking it up/dropping it?

avatar image jg2115 · Jul 25, 2013 at 11:34 PM 0
Share

I am picking it up and dropping it by using physics.raycast to deter$$anonymous$$e the cube clicked on.

avatar image Benproductions1 · Jul 25, 2013 at 11:38 PM 0
Share

I asked how you pick it up, not how you deter$$anonymous$$e which one to pick up :|

The answer you have is a good one, you should probably accept it :)

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
3
Best Answer

Answer by Grim_Darknight · Jul 25, 2013 at 01:45 AM

For your cubes if all they do is move verticaly you can constrain their movement in the X and Z axis on the rigidbody component. You can also lock the rotation which will keep them oriented properly.

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 clunk47 · Jul 25, 2013 at 02:34 AM 0
Share

@jg2115 Even though the question was "$$anonymous$$aking a cube fall without rigidbody", this is a good solution. You weren't wanting to use a rigidbody simply because of the shaking and whatnot, follow this guy's advice and have a look at Rigidbody.constraints. This is an easier solution than moving the cubes manually with code, and using raycast to detect landing.

@Grim_Darknight +1

avatar image FreeTimeDev · Jul 25, 2013 at 05:03 AM 1
Share

Rigidbodies are pretty useful. Combine that with raycasting and some educated guesses and you could turn gravity on/off (or velocity) and relocate the object to the correct height as soon as it gets close (to snap it in). After it's locked in, disable the rigidbody until you need it again.

Without knowing more I'd think the rigidbody is still the answer here and that you should be asking how to better utilize it if you still need help getting what you want.

avatar image clunk47 · Jul 25, 2013 at 05:08 AM 0
Share

You could also use raycast to detect if a cube is sitting on another cube, and lock the position, then make the rigidbody kinematic so it will stay in place. Then when you click on it, make it non kinematic again so it can be dragged around. It you're interested in this idea I'd be happy to do a basic tutorial for you.

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

19 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

Related Questions

Object goes through wall. 0 Answers

How to get movable/pushable cubes right? 0 Answers

Cube starts shaking when placed on a giant sphere 1 Answer

How to make player collide with ground? 1 Answer

OnMouseDown() tracking bad at 3D box collider 0 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