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 Eugenius · Jun 23, 2013 at 02:59 PM · collisiontriggercollidersboxmechanics

Box mechanic: Is it possible to know when the box is closed on all margins?

Update 2: I have come up with a solution but I need to know how could I make my AI look into a direction and find the closest object (by tag) to it then calculate the distance to it and repeat the step a couple of times. I will post another question for this particular issue and close this one when I have a proper solution.

Update: I have tried using OverlapSphere to count the collisions -- doesn't work as it sometimes can count more than needed.

I have tried using a box collider around the AI -- same as above.

I have tried making 4 colliders in 4 direction attached to the AI to check for collisions on directions -- also same as above.

Reopened as I've found out that my solution will not provide me with the feature that I want and would become to complex at a point.

Please provide me with any other solutions you may think about!

Hello,

This is going to be a pretty big question. I hope it's not something very hard to do, honestly.

I want a mechanic like this (i already have it -- kinda):

Refresh to see picture -- I hope When I click on the screen, the Start Point is created and it instantiates a line/fence, the last piece is considered an End Spot which offer three possibilities of continuing -- any of the other three directions

I'd like to know how could I check if a closed box is created through this mechanic? I want something to happen when the box is closed, how should I go about in doing so? Any info, even tutorials for things that could get me here will receive thumbs up ^_^.

Thanks a lot for any help!

box_find.png (10.9 kB)
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 Owen-Reynolds · Jun 23, 2013 at 03:58 PM 1
Share

Is your game on a grid? A 2D array backing it? Looks like you can only move NESW, so it is? If so, standard (recursive) graph/grid searches can find connected areas.

Otherwise to search in the fake "world" for gaps is a poorly defined giant pain.

avatar image Eugenius · Jun 23, 2013 at 04:04 PM 0
Share

Nope, it isn't on a grid. I want to keep continue working on it without a grid to see what I can come up with but if its absolutely necessary I will set up a grid to sustain it.

1 Reply

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

Answer by Owen-Reynolds · Jun 23, 2013 at 05:27 PM

If this is a game, I'd have things crawling along the edges -- a simple ray cast & turn left on a hit movement script. Have them ignore each other so they can crawl clock and counterclock-wise, some fast (may miss small gaps) and some slow. They all want to flee off the edge of the map or something. They may be trying to get in or out.

Say the goal is to protect some candy inside the box, which respawns (and you lose points) when it's eaten. You won't know the box is sealed, but if they can't get in or find it difficult to get in, you get lots of candy points, so who cares.

The end may not be exactly what you were thinking, but, especially in a game, it never is.

Comment
Add comment · Show 2 · 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 Eugenius · Jun 23, 2013 at 05:41 PM 0
Share

That's a really great advice! Thank you, but that would change the whole purpose of the game (yes, it is a game).

I am actually trying to capture something with the box, so I want to trigger the "isCaptured" variable when it actually is captured. The thing that needs to be captured is moving around randomly and that is the purpose of the game.

Currently I have 4 colliders(up&down, left&right -- pretty messy but it was just a quick fix for show off) attached to my AI but that doesn't help because it gets captured even if it collides in the exact points without anything else being linked together.

Any other ideas?

avatar image Eugenius · Jun 27, 2013 at 07:53 AM 0
Share

@Owen, I am marking your answer as it is the correct one for the question I asked.

I would like to add that I am currently finding a better choice for myself to use Physics.OverlapSphere or a Sphere Collider with a wide radius then check if the number of collisions with the walls and the start/end points are equal to 4 therefore considering it captured.

As you said this is also not the end result expected by me but it is better than changing the whole structure of the game.

Thanks for the help!

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

16 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

Related Questions

Multiple Cars not working 1 Answer

How do I use colliders and/or triggers to end the game? 1 Answer

Does OnTriggerStay don't detect a collision with a non-trigger collider? 1 Answer

Trigger Colission not only works sometimes 1 Answer

How do I make colliders collide when Tİme Scale is zero? 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