Cita de: Igor date=1526993259"Input.compass.trueHeading" te dice (en grados) hacia donde esta orientado tu dispositivo, en relacion con el norte (si estas mirando hacia el Este (exacto) te dara 90, si estas hacia el Sur te dira 180, si estas al oeste te dira 270? ... -90? nose... jeje
hay tienes una parte de lo que necesitas
(igual tienes que activarlo con "Input.compass.enabled = true"; pero creo que devuelve el angulo invertido.... miralo bien por si acaso)
ese es el ejemplo que viene en la documentacion sobre "Input.compass"
function Update () {
// Orient an object to point to magnetic north.
transform.rotation = Quaternion.Euler(0, -Input.compass.magneticHeading, 0);
}
y con "Input.location" puedes hayar tu posicion...
luego tendrias que saber las coodenadas del Emisor/antena (del punto hacia el que quieres apuntar)
hayas el algulo entre los dos puntos Math.Atan2(puntoHaciaElQueQuieroApuntar - puntoDondeEstoyYo);
y le restas los grados que te decia la brujula con "Input.compass.trueHeading;"
y estonces dibujas un sprite en pantalla en el angulo que te ha dado.
este es el ejemplo sobre "Input.location" que viene en la documentacion:
using UnityEngine;
using System.Collections;
public class TestLocationService : MonoBehaviour
{
IEnumerator Start()
{
// First, check if user has location service enabled
if (!Input.location.isEnabledByUser)
yield break;
// Start service before querying location
Input.location.Start();
// Wait until service initializes
int maxWait = 20;
while (Input.location.status == LocationServiceStatus.Initializing && maxWait > 0)
{
yield return new WaitForSeconds(1);
maxWait--;
}
// Service didn't initialize in 20 seconds
if (maxWait < 1)
{
print("Timed out");
yield break;
}
// Connection has failed
if (Input.location.status == LocationServiceStatus.Failed)
{
print("Unable to determine device location");
yield break;
}
else
{
// Access granted and location value could be retrieved
print("Location: " + Input.location.lastData.latitude + " " + Input.location.lastData.longitude + " " + Input.location.lastData.altitude + " " + Input.location.lastData.horizontalAccuracy + " " + Input.location.lastData.timestamp);
}
// Stop service if there is no need to query location updates continuously
Input.location.Stop();
}
}
Hola, estoy muy agradecido con esta informacion que me has comprtido ahora mismo lo pruebo te digo pero desde ya te doy las gracias. Saludos
??