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 Ignacio 1 · Mar 11, 2011 at 05:01 PM · gameobjectraycastempty

Raycasting an empty object

Hi! I'm making a simulator with a 3D cockpit and I need to make use of "hotspots" in order to operate the panel's switches. The artist has created an empty node in the model while I, using an initialization script, assign it a box collider during the start phase.

The box collider seems to be well assigned (see the screenshot) but, somehow, the "hotspot" doesn't get detected by the raycast. Please, notice that the raycast function is already being used to detect the collision with other switches and it's working fine. Do you have any ideas on how can I solve this?

Thanks in advance!

alt text

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

1 Reply

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

Answer by Statement · Mar 11, 2011 at 05:08 PM

Id make sure your box isn't a trigger, or if it is, you need to enable raycast with trigger in PhysicsManager. Is your cockpit equipped with a collider that might block the raycast? If so, you might want to either get rid of it, or move the hotspot, or set a different layer mask that you then perform raycast against. I can't think of anything else that should be set for this to work.

You can also debug what your raycast is hitting by obtaining the hit objects name and present it in a GUI.Label. Maybe you're hitting something you didn't expect at first?

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 DaveA · Mar 11, 2011 at 06:47 PM 0
Share

That box looks a bit 'off' from the switch, and small. Do what Statement said. I would think you do want it to be trigger though. $$anonymous$$ake sure it's in a good layer, not one that ignores rays. Are you using Physics.Raycast or Collider.Raycast? Debug.Log can also be your friend.

avatar image Ignacio 1 · Mar 11, 2011 at 06:52 PM 0
Share

Thanks for your reply! I was making a very silly mistake, but now everything's working O$$anonymous$$!

avatar image Ignacio 1 · Mar 11, 2011 at 06:54 PM 0
Share

@DaveA: Sorry, I hadn't seen your reply before posting $$anonymous$$e! The hotspot is now working. I assigned it just a collider, I didn't need to set it as a trigger.

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

Ray Casting - Trigger function 1 Answer

Get object name from raycast. 1 Answer

Need help with building system 1 Answer

How to store player model and then swap the model to an object I Raycast hit? 0 Answers

Creating a teleportation gun 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