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
- Specular lighting visible in a camera with Path Tracing when Preserve specular lighting is disabled in observed material
- Cinemachine package throws CS1061 errors in the Console when installed in a project that has HDRP and URP installed
- Editor.log file size grows rapidly when a scene exceeds the "Maximum Shadow on Screen" limit setting in the HDRP Asset
- Player build freezes after calling Application.Quit() when the scripting backend is set to IL2CPP
- Texture is not applied on a Custom Render Texture when a Cubemap is selected as the texture
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