You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
714 B

  1. using UnityEngine;
  2. using System.Collections;
  3. public class MagnetEffect : MonoBehaviour {
  4. public GameObject magnetTipObject; // Object for placing Magnet Ray
  5. // SELF-NOTE: You will need to connect this script to the player controls
  6. // in order to make use of the ShootRay() function.
  7. // Use this for initialization
  8. void Start () {
  9. }
  10. // Update is called once per frame
  11. void Update () {
  12. }
  13. // FUNCTION: Shoot Magnet Ray
  14. void ShootRay(){
  15. RaycastHit hit;
  16. if(Physics.Raycast(magnetTipObject.transform.position, magnetTipObject.transform.forward, out hit)){
  17. if(hit.collider.tag == "moveable"){
  18. print ("Magnet Laser hit the object : " + hit.collider.gameObject.name);
  19. }
  20. }
  21. }
  22. }