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 DaveA · Jan 28, 2011 at 12:37 AM · colliderdistancemouseoveronmouseenter

OnMouseEnter over a Collider, what's the distance?

I'm trying to use OnMouseEnter (and Exit) on some colliders to be able to enable some GUI elements.

It works fine, when I'm within a certain distance (it seems). I don't see any way to tell Unity what that distance is (like you can with raycasting). I would think that no matter what the distance, if the mouse is over the rendered collider, it should get these mouse events.

I'm using a mesh collider which is a mashup of two cubes, one facing 'out' and one facing 'in', so that even if you are inside the cube collider, it should still detect the 'inside' faces and register a 'hit' (mouse is over it), right?

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 3DMagicVR · Jan 28, 2011 at 01:54 AM 0
Share

Hi, you need to be more specific because if you are trying to use the "On$$anonymous$$ouse" functions inside a big cube there always be in contact with the surface of the cube I don't think that's what you really want, I'm rong?

avatar image Bunny83 · Jan 28, 2011 at 03:34 AM 0
Share

I don't think that your collider will work if your cube have inverted faces. Besides that On$$anonymous$$ouseEnter is only called once, the moment you're getting over the collider. if you are inside the cube (and the inverted cube is closed) it wouldn't matter in which direction you look, you're always "over" the collider. That means you can't "enter" or "exit" the collider. $$anonymous$$aybe just tell us what you are trying to archive...

avatar image DaveA · Jan 29, 2011 at 07:29 PM 0
Share

It does, just not consistently, I'm trying to figure out why that is.

1 Reply

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

Answer by Eric5h5 · Jan 28, 2011 at 01:53 AM

The default raycast distance, which OnMouse events use, is Mathf.Infinity. i.e., there is no distance limit.

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 DaveA · Jan 29, 2011 at 07:31 PM 0
Share

I thought so, because some of them trigger at any distance. Some I must get right up on, as though there were a shorter limit, or something else is occluding the hit. If I had part of another collision volume in the way, would that prevent On$$anonymous$$ouseEnter/Stay/Exit?

avatar image Eric5h5 · Jan 29, 2011 at 10:12 PM 0
Share

If it's being blocked by another collider, then yes, On$$anonymous$$ouseStuff won't fire, same as if you were raycasting manually. You can put colliders on the IgnoreRaycast layer and they won't block.

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

No one has followed this question yet.

Related Questions

How to use Sphere colliders to detect the "Player" 1 Answer

Mouse Over Wont Work on Bone Animated Meshes. 1 Answer

Collider and Distance Problem OnMouseDown 1 Answer

OnMouseEnter through colliders 2 Answers

Problem with OnMouseDown(not registering clicks in some situations) 0 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