• 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 CHRISYS · Nov 30, 2013 at 06:28 PM · collidersraycastingray

How to make raycast go through various colliders

HI there...!! well i realy need help with this plz...!!!

so the things is that i want to raycast and that ray get me all colliders that the ray go through.

Imagine you have 2 sphere colliders, a sphere inside a sphere, so one in center with the tag core and the other the bigger one called shield, and when i raycast lets say i just want for now Debug.log(); the tag the collider have on console so the console out put will be:

shield. core.

and etc if there were other colliders in the raycast trayectory.

plz guys help me with this...!! what i try to achive is to identify where my player got hit so the player have a mesh collider but to know where the bullet hit like arm, leg, body, head etc. i would like to use a trigger, or if some one out there got another idea on how to know on where part of the body the bullet hip pla make me know...!!!

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
2
Best Answer

Answer by fafase · Nov 30, 2013 at 06:28 PM

I guess this should do it:

https://docs.unity3d.com/Documentation/ScriptReference/Physics.RaycastAll.html

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 BurtBotGames · Dec 28, 2020 at 02:01 AM 0
Share

This worked perfect! Thanks for the post

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

17 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

Related Questions

Casting ray forward from transform position 1 Answer

How come people prefer to use rays for 2d collision instead of edge colliders? 1 Answer

Raycast2D doesn't seem to work correctly. 1 Answer

Raycast not visible 1 Answer

RaycastHit returns object without collider, in wrong layer 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges