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 CiberX15 · Oct 03, 2013 at 07:16 AM · algorithmdestructible

Check connection to ground algorithm?

Ok so I need some help with this one. I am trying to create a fully destructible system where parts of structures will break if they do not have a connection to the ground. For example, if you knocked out the bottom story of a two story house, the second story should break. However, I am not using physics simulation with this.

So basically I want each object to be able to check the surrounding objects and see if it can trace a path back to the ground. Objects that are on the ground already have a "Grounded" variable I just don't know how to get to trace a path through the connected objects.

I would really appreciate it if someone could point me in the right direction on this one. Is there some sort of algorithm for calculating things like this?

Thanks in advance : )

P.S. I prefer Java Script, but I can probably figure out C# at this point.

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 Fattie · Oct 03, 2013 at 08:07 AM 0
Share

it's really unclear what you mean.

to check "surrounding objects", learn about raycasting. search on here for 1000s examples. but that involves using the "physics" in unity - colliders and so on.

it's very strange why you are not just using the physics in Unity. Why use Unity, if not using the physics?

To do what you describe using the built-in physics is trivial.

avatar image robertbu · Oct 03, 2013 at 08:43 AM 0
Share

Unless there are special properties to the objects you can take advantage of, this is a hard problem to solve that may involve reinventing some of the physics engine. For example, if one block is cantilevered and unbalanced, it should fall even though it is connected to the ground. As @Fattie mentions, raycasting would be a potential solution, but imagine a narrow block on top of a large block. You just can't raycast from the center of the large block because the small block may be many places on top of the large block. And the issues go on. If this a general problem, then use the physics engine. If this is a specialized app, then you need to describe it in detail if you want accurate suggestions.

avatar image CiberX15 · Oct 04, 2013 at 07:41 PM 0
Share

@Fattie

I am well acquainted with raycasting, the problem is passing information across several blocks so that a network of touching blocks can deter$$anonymous$$e if at least one of the blocks in the network is connected to the ground. Preferably in a single function call rather than something that has to run every Update()

@robertbu

That's actually getting way more complex then I actually need. Think $$anonymous$$inecraft blocks, now think $$anonymous$$inecraft trees where you take out the bottom block and the rest does not fall down. That's what I want to solve.

For example this is what I have now:

/Called when a block is broken near us function GetGround() { Debug.Log("Get Ground" + gameObject.name); // skip this test if the object is grounded if(Grounded) { Debug.Log("Block Grounded: Skipping Check"); HasLinkToGround = true; return; } Debug.Log("Setting Link To Ground to false"); //Do not assume link still exists HasLinkToGround = false; //Check all around us TraceAll(); Debug.Log("Trace Data:"); //Check if anything we are touching is connected to the ground for(var i = 0; i < HitAll.length;) { Debug.Log("#" + i); if(HitAll[i] != null) { Debug.Log("Face Has Link To Ground = " + HitAll[i].gameObject.name); if(HitAll[i].HasLinkToGround) { HasLinkToGround = true; return; } } i++; } Debug.Log("No link call break block"); //If not connected break BreakBlock("Lost Link To Ground"); }

The problem is this check only goes one deep because as soon as it hits something that was grounded earlier it returns true even if the block it hit only has a link oto the ground because it is connected to the very block that is trying to see if it is connected to the ground.

avatar image Fattie · Oct 05, 2013 at 08:01 AM 0
Share

I truly recommend you simply look at the huge $$anonymous$$ecraft starter kit freely available on the forums. And the 1000s questions here on $$anonymous$$ecraft

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

15 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

Related Questions

Need an Algorithm to solve the Geometric Puzzle 2 Answers

object destroying 1 Answer

Structural Stability 0 Answers

Combine mesh and merge the neighboring vertices 1 Answer

The algorithm of curve in Shuriken Particle System 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