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 FreeWheelBurning · Jan 10, 2015 at 03:37 PM · gameobjectraycastlayersheirarchy

Using a Empty GameObject "Grouper" - Won't Ignore Raycast

I have a group of AI characters grouped inside an empty Game Object. The empty Game Object is just there for organizing the hierarchy - I'll call it my "grouper". My problem comes when another AI is trying to use a raycast to confirm line of sight to an enemy. It always hits the grouper Game Object instead of the AI itself, and hence returns an object I don't care about.

I set the grouper Game Object to the "Ignore Raycast" layer (but left the AI characters in default) thinking that would fix my problem, but it did not.

Is there a way around this that I am missing?

Comment
Add comment · Show 1
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 FreeWheelBurning · Jan 10, 2015 at 04:20 PM 0
Share

UPDATE: This was due to an error in my code - please ignore! (Is proper etiquette to delete this now?)

1 Reply

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

Answer by tanoshimi · Jan 10, 2015 at 03:38 PM

Raycasts only hit colliders. So, unless your "grouper" object has a collider component (which it shouldn't), it won't be detected - there must be some other bug with your code.

Comment
Add comment · Show 3 · 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 FreeWheelBurning · Jan 10, 2015 at 04:02 PM 0
Share

$$anonymous$$y hierarchy looks like this:

GrouperGameObject (at root level of Hierarchy)

  • AIEntity1

  • Collider

  • AIEntity2

  • Collider

  • Etc

When the raycast hits AIEntity2's Collider, I wish it returned the AIEntity1 (or the Collider itself) but it doesn't, it returns the GrouperGameObject, which doesn't let me know which AIEntity I hit.

avatar image tanoshimi · Jan 10, 2015 at 04:12 PM 0
Share

What's your RayCast code?

avatar image FreeWheelBurning · Jan 10, 2015 at 04:19 PM 0
Share

Well shoot, I just found the error in my code. Thanks for your help!

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

2 People are following this question.

avatar image avatar image

Related Questions

Layered Collisions 1 Answer

GameObject facing hit.point doesn't always work 1 Answer

Move up gameobject from under the ground or object (vibration problem) 0 Answers

Unity 2021 LTS: IPointerEnterHandler is broken 1 Answer

Raycasthit info only working the first time the object is hit 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