Search Issue Tracker
By Design
Votes
0
Found in
2018.4
2019.2
2019.3
2019.3.0b3
2020.1
Issue ID
1185183
Regression
No
Raycast will ignore a set up LayerMask when and Object with such Layer has a Parent which has a RigidBody Component
Steps to reproduce:
1. Open user's attached project
2. Open SampleScene
3. Enter Play mode
4. Press "Space" key
5. Notice the console message "Shouldn't hit me"
Expected results: Raycast only hits Objects with Colliders and only GameObjects in Selected LayerMask
Actual results: If a GameObject has a Parent with RigidBody, the GameObject will not be hit even if it is in a specific LayerMask, Instead the Parent will be hit
Reproducible with: 2018.4.0f1, 2018.4.12f1, 2019.3.0b10, 2019.2.12f1, 2019.3.0b10, 2020.1.0a12
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Required SpriteMask class (ID 331) is stripped when "Strip Engine Code" is enabled
- “Maximized serialized file backup not found” error is thrown when minimizing a window in a newly opened project
- Build stack trace contains invalid lines when building with IL2CPP using scripts with delegates containing generic types in the signature
- Entities Systems window has a “Show Full Player Loop” dropdown which does nothing when clicked after enabling “Show Full Player Loop”
- Entities Hierarchy Search “Show/Hide” button’s Lens Icon is blurry when the Editor is on an external monitor
Resolution Note:
This is probably counter-intuitive in 2019, but RaycastHit.transform is supposed to get you the transform of the rigidbody the collider is part of (the collider's transform otherwise). https://docs.unity3d.com/ScriptReference/RaycastHit.html