Quantcast
Channel: iOS and tvOS
Viewing all articles
Browse latest Browse all 10823

Raycast on child gives parent name in hit.transform.name

$
0
0
Hi I cast ray like this.
I have to ignore the layer number 8

Code (csharp):
  1.  
  2. var layerMask = 1 << 8;
  3. layerMask = ~layerMask;
  4.                
  5. if(Physics.Raycast(ray, hit, 100, layerMask))
  6. {
  7.     print(hit.transform.name);
  8.     if(hit.transform.name == "ChildObjName")
  9.     {
  10.         print("yes child obj");
  11.  
  12.     }
  13. }
  14.  
I have assigned the Layer number 8 to Parent Object and I need to cast ray on its child object....

Raycast on child gives parent name in hit.transform.name

Viewing all articles
Browse latest Browse all 10823

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>