janjicm

Untitled

May 13th, 2020
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class playerpush : MonoBehaviour
  6. {
  7.  
  8. public float distance = 1f;
  9. public Transform pickup;
  10. public LayerMask boxMask;
  11.  
  12. // Start is called before the first frame update
  13. void Start()
  14. {
  15.  
  16. }
  17.  
  18. // Update is called once per frame
  19. void Update()
  20. {
  21.  
  22. Physics2D.queriesStartInColliders = false;
  23. RaycastHit2D hit = Physics2D.Raycast (pickup.position, Vector2.right * transform.localScale.x, distance, boxMask);
  24.  
  25. }
  26.  
  27. void OnDrawGizmos()
  28. {
  29. Gizmos.color = Color.yellow;
  30.  
  31. Gizmos.DrawLine(pickup.position, new Vector3(pickup.position.x + distance, pickup.position.y, pickup.position.z));
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment