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 Winston · Jan 17, 2012 at 01:16 PM · raycastingvectorspaceboundsshared

Shared Vector / Bounds Problem

Hey all

Say in Unity you have 2 different sized boxes, 1 large and 1 small. How can I tell if the small box is within the bounds of the large box. I can not use collision detection because I need this process to repeat a couple thousand times quickly and neither raycasting because the normals of the collider are on the opposite side. I am currently using the bounds contains function however when rotating the large box object the bounds expands to cover the diagonal angle of the rotation.

Any suggestions? Many thanks to all those that can help.

  • Winston

Comment
Add comment · Show 3
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 · Jan 17, 2012 at 01:42 PM 0
Share

"How can I tell if the small box is within the bounds of the large box.".......

You mean within the box .. right? i.e. you DO NOT want to know if it is within the Bounding Box, you want to know if it is ACTUALLY within the BOX. Correct?

PS it's sometimes best to turn the object inside out in cases like this, then you can use ray casting.

avatar image Winston · Jan 17, 2012 at 05:09 PM 0
Share

Yes. You are correct. Do you know of any simple functions that exist and will achieve this?

avatar image Fattie · Jan 18, 2012 at 07:33 AM 0
Share

Hi Winston.

(1) I understand what you're after now.

(2) Unfortunately (like many problems in real-time ga$$anonymous$$g) it's not easy by any means!

(3) Note that essentially you are trying to check if all 8 corner points are contained in the other box.

(4) In answer to your question, there is NO simple, everyday function or API available that will instantly check this for you - you have to develop the maths for your situation. To begin with this sort of field, you can look in to the classic text Real-Time Collision Detection - Christer Ericson and also Eric Lengyel 'Game $$anonymous$$athematics'.

(5) Your question is confusing because in both the title and the 2e sentence you say "the bounds of..." suggesting you are after the "Bounding Box" ("OBB") solution -- which is a totally and completely different problem set. You should click edit. Better you should probably just delete this question altogether and post a new question saying simply "does anyone have a good solution on hand for box within box calculations" and then note that you are looking for "not OBB, the actual boxes in space". You could also look on for example stack overflow and gamedev

(6) FTR I had a glance around and couldn't find any ready-to-roll solutions!

Hope this info helps you !

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Rod-Green · Jan 17, 2012 at 01:33 PM

Basically what you're trying to achieve is a OBB to OBB collision detection. There should be lots of examples out there but here's a good table to help you start:

http://www.realtimerendering.com/intersections.html

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 Fattie · Jan 18, 2012 at 07:34 AM 0
Share

For the record Rod, it turns out he's explicitly NOT looking for an OBB solution - he wants to check the actual box against the actual box.

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

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Check if player is in front of enemy? 4 Answers

Rotating Raycast with object?? 1 Answer

IsGrounded does not work 3 Answers

2D: Why aren't my raycasts conforming to their origin points? 2 Answers

Keeping the player inside the screen? 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