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
1
Question by Liquid Lithium · Feb 03, 2013 at 03:53 AM · collidertower-defenseonmouseenteronmouseup

OnMouseEnter through colliders

EDIT (FIXED): I fixed it , it was due to the fact that the tower inherited the layer of the tile, being a child of it.(Another solution was to click on the physcis settings and set the raycast to ignore triggers, it will then ignore the range sphere which is trigger) Thanks for the answers :)

Hello all! I'm making a tower defense game in unity indie , and i've set up all the turret system and the grid system (there's no free placement of the towers) and I met a big problem. Each square of the grid highlights and is selected when you hover it , and creates a tower when you click on it. This works fine. But on my tower there is a sphere collider, it's the range of the tower . It's pretty big and all ennemies who enter it are shot at ( it's a "is trigger"). As soon as the tower is created, this collider is obviously created with it, it's part of the tower. This collider being big, it seems to block the access to the tile around it ( the tiles of the grid a bit further works still fine ) , meaning I can't hover any tiles around it , cause the mouse gets on the sphere first , which is in front of the tile. It's logical, but is there a way to get around this? I tried ignorelayercollision , but no luck with that. (Oh and the tower is child of the tile) Thanks for reading, I hope you can help me :) Edit: Here's a screenshot ; alt text

untitled-1.jpg (57.4 kB)
Comment
Add comment
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

2 Replies

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

Answer by Vonni · Feb 03, 2013 at 04:18 AM

Ignore layer should work just fine, but I dont like using it :S

If you use PhysicsRaycastAll it returns an array of hits. This makes it very easy to mask out the sphere collider.

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 Liquid Lithium · Feb 03, 2013 at 08:36 AM 0
Share

Thank you very much. I used ignore layer , it didn't worked, but I finally got why ; As the turret was the child of the tile , it takes the same layer . So the tile had to ignore a layer (turret layer) which was empty, because the turret when instantiated as a child , inherits the effects on the layer of the parent. Now it works, I have changed the layer to default and made the hover part on the layer tile , but as a child of the tile object, exactly like the turret, but the turret on layer turret. Hope i'm clear :P

avatar image Vonni · Feb 03, 2013 at 02:08 PM 0
Share

Cool Beans

avatar image
0
Wiki

Answer by DryTear · Feb 03, 2013 at 04:09 AM

if your camera is orthographic, replace sphere collider with capsule collider, and set it to Y and the height to 10.

Then the orthographic camera's Y to 9 so the camera is inside the trigger.

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

11 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

Related Questions

GUI flashing on hover 0 Answers

Check if tower is already placed 1 Answer

Sound won't PLAY!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1 Answer

object collision does not work 2 Answers

How do you detect OnMouseEnter on a collider that is behind a GUI element? 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