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 Default117 · Feb 20, 2012 at 01:28 AM · colliderboundscontains

bound.Intersects returning true when false

I'm having some issues with a bounds.Intersects check. I'm generating a mesh based on the frustum so there is a cube going straight down the center of the screen in proportion based on the distance it is from the camera. On the scene i have plane objects which i can press on and drag around the screen. For example i have a plane at -24 on the z axis with a sphere collider and when i drag it around it does an Intersects check to see if it is within the cube it returns true even though you can clearly see that they do not intersect: alt text

With another example example, this time i have another plane but further from the camera position, this collider is a capsule collider and it perfectly returns true/false if the colliders are intersecting.

And i missing something? Is there an issue with doing a check with a sphere collider or something to do with the distance from the camera? Or the shape of the bounds im checking? Are the bounds just checked as a cube? Or does it actually check the real mesh?

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 Eric5h5 · Feb 20, 2012 at 02:02 AM 2
Share

Bounds are cubes by definition. (Well, cuboids.)

avatar image Default117 · Feb 20, 2012 at 02:31 AM 0
Share

Gotcha! Thanks for that, i had a funny feeling it would have been something like that, silly me =P

1 Reply

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

Answer by Default117 · Feb 20, 2012 at 05:57 AM

I ended up checking where i click, taking that objects' z depth and using it as a "cut height". Using this height relative to the position of the mesh im checking against, i could use this formula:

 Vector2 cut_side = (cut_height/total_height)*(bottom_side) - top_side) + top_side;

This formula returns the width and length at a given height, so now i can use those values to determine the 4 vertices of slice of the mesh i just clicked on.

Since i know what the length and width is for the top and bottom squares of the mesh i turned this data into a Rect and then did a check against that to see if the object is within the rect (Collision).

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

6 People are following this question.

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

Related Questions

3d Text how do you autofit to a fixed space 0 Answers

How to check the place before drop the object 1 Answer

collider bounds intersect but than for a UI button element 0 Answers

Problem with checking for intersection between two rotated objects 3 Answers

Collider2d.bounds.Intersects not detecting intersection 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