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 Nosebud · Jun 15, 2014 at 08:44 AM · 2dboxcollide

No bounce in 45° boxes ?

Hi erverybody,

I am trying to build something like CandyCrush but with 45° rotated boxes. It is my first project and as far as it goes it makes really fun.

I build 3 Boxes, set them to X=0 and rotated them in an 45° angle. Added Rigidbody and a BoxCollider2D. When they now drop they seem to partly fall inside of each other, then bounce to top, down again etc.. The problem seems to persist because of this Script : void Update () { Vector3 pos = transform.position; pos.x = 0; transform.position = pos; } The idea is to build x instances of my cubes later with an fixed X and let them fall into the scene at the right position.

Does anybody have an idea how to achieve this in an other way, or how to fix this bouncyness ?

Comment
Add comment · Show 4
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 Owen-Reynolds · Jun 15, 2014 at 05:07 PM 0
Share

The title is confusing -- sounds like you want to use rigidbody physics to make a grid-based game. I would almost say to make it purely grid-based first -- everything snaps. Then add rigidbodies later for decoration.

Take a look at locking an axis (in the rigidbody) and using is$$anonymous$$inematic to freeze them. Because 10 stacked rigidbodies act like gelatin squares.

avatar image Nosebud · Jun 15, 2014 at 05:24 PM 0
Share

I think you understand what I want. I didn't had any other idea how to make a grid based game. Gonna look for a tutorial of a grid game without physics.

avatar image Owen-Reynolds · Jun 16, 2014 at 01:36 PM 0
Share

Seems to me, the main part of a game grid is knowing how to use 2D arrays. Like using a loop to find the 1st used spot in a column, and another loop to find the next used spot.

That's standard computer program$$anonymous$$g stuff, but takes a while to learn if you don't already know it. Like, you start with stuff like finding the last 'x' in a 1D array.

avatar image Nosebud · Jun 16, 2014 at 07:05 PM 0
Share

Don't have a problem with using 2D arrays :). thing is I tried it without an array, just with phycs and exact measurement. Should be much easier with a standard boardobject and an array with BoxObjects.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by sedativechunk · Jun 15, 2014 at 08:49 AM

I'm not sure exactly how or what you are trying to do. But what I can tell you is that if you DON'T want the boxes to interact with each other via physics then you can mark the "is trigger" button on the colliders. When objects are not triggers, they will use unity's physics engines, so if you are boxes are rubbing/sliding together like you say, there is a good chance that is what is making them "bounce". If you stacked them all using colliders and nothing is holding them in place, then you may have to find some other workaround for the problem.

Comment
Add comment · Show 1 · 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 Nosebud · Jun 15, 2014 at 09:33 AM 0
Share

I want them to interact, but more with something as a "stop" component. IF they collide thzey just shouldn't drop into each other, bounce away or anything else.

avatar image
0

Answer by hayer · Jun 17, 2014 at 09:34 AM

See http://docs.unity3d.com/430/Documentation/Components/class-PhysicsMaterial2D.html

Try setting Bounciness(Restitution?) to 0.0.

Edit: [Adding some info] Since Unity is using Box2D(if I'm not mistaken) there will nearly always be a small overlap before the collision is resolved and approprierte forces are calculated and applied to the objects.

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

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

need help please! 0 Answers

I need an Einstein! Destroying part of a cube/mesh 0 Answers

How to move BoxCollider2D so it covers a line renderer? 0 Answers

Collision problem 0 Answers

2D Animation does not start 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