Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 /
This question was closed Apr 04, 2019 at 11:40 AM by AlexVlad for the following reason:

Solved the problem by myself eventually

avatar image
0
Question by AlexVlad · Apr 02, 2019 at 11:33 PM · colliderclickinterfacepointerblocking

Making OnpointerClick event ignore certain colliders.

Hello,

I am using interfaces to implement pointer click and pointer up functionality for some objects in my scene. The game has a first person action camera following my player. The Interface works fine on all the objects except when the player's capsule collider gets in the way.

For example, if an object I want to click is slightly to the left of the player and very close, nothing happens when I click it because the clicks are hitting the player's capsule collider first. I am not saying that the object is obscured by the player, I am saying the player's collider is wider than the player model so it appears I am clicking next to the player character but I am actually hitting his collider. If i move the player a little more to the right I can click the said object.

I've tried putting the player on the Ignore Raycast layer but it doesn't work. How can I get the click event to trigger if my object is masked by another collider?

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 surfuay · Apr 03, 2019 at 03:39 AM 1
Share

this may not be what you want, but have you considered making the player's capsule collider slightly smaller than the player itself. It's more of a work around. Otherwise you'll need to play around with the EventSystem and do a check for where the click position is before calling the action you want.

avatar image AlexVlad surfuay · Apr 03, 2019 at 07:53 PM 0
Share

Hey, thanks for the reply. Yeah, I though about it, but the player's capsule collider size is set this way for proper interactions with what else is going on in the scene.

I think I will have to do it this way and adapt everything else to the change.

Thanks! :)

avatar image surfuay AlexVlad · Apr 03, 2019 at 09:36 PM 0
Share

maybe try this, i used it when i had multiple UI objects purposely over each other https://docs.unity3d.com/ScriptReference/EventSystems.EventSystem.IsPointerOverGameObject.html

1 Reply

  • Sort: 
avatar image
0

Answer by Esteem · Apr 03, 2019 at 09:04 PM

...I've tried putting the player on the Ignore Raycast layer but it doesn't work...

it does work, you're probably doing a tiny bit of it wrong. can you show us the code you're using for masking the player collider?

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 AlexVlad · Apr 04, 2019 at 11:40 AM 0
Share

Hey, I figured it out. In the Physics Raycaster's Event $$anonymous$$ask I took out the Player layer and it works now. Thanks for taking the time to reply :)

Follow this Question

Answers Answers and Comments

133 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 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 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 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 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 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 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 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 avatar image avatar image avatar image avatar image avatar image

Related Questions

No Buttons Click when Play Exported WebGL version of the Game 0 Answers

Blocking Click through on GUI components 0 Answers

How to disable click to move on interface elements ? 0 Answers

GameObject becomes 'unselectable' 1 Answer

Collider ignore raycast 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