Advertisement
Guest User

raycast

a guest
Jun 25th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.37 KB | None | 0 0
  1.                 if (Physics.Raycast(ray, out RaycastHit raycastHit, 100f, raycastLayer)) {
  2.                     MoveableObject objectHit = raycastHit.collider.GetComponent<MoveableObject>();
  3.  
  4.                     if (objectHit.ReachedTarget == false) {
  5.        
  6.                         hitPoint.transform.position = raycastHit.point;
  7.                         hitPoint.transform.parent = objectHit.transform;
  8.                         AddForceAtPosition = true;
  9.  
  10.                     }
  11.                 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement