-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathselection.cs
More file actions
38 lines (32 loc) · 819 Bytes
/
selection.cs
File metadata and controls
38 lines (32 loc) · 819 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class selection : MonoBehaviour
{
//objeto que marca el objeto seleccionado.
public GameObject slc;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
selectv2();
}
public void selectv2()
{
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit2D hit = Physics2D.Raycast(ray.origin, ray.direction, Mathf.Infinity);
if(hit)
{
s1 = hit.transform;//objeto seleccionado.
seccionado(s1);
}
}
public void seccionado(Transform b)
{
slc.transform.position = b.transform.position;
slc.transform.Translate(0,0,-1);
}
}