Mostrando entradas con la etiqueta Intermedio. Mostrar todas las entradas
Mostrando entradas con la etiqueta Intermedio. Mostrar todas las entradas

martes, 16 de agosto de 2011

Mostrar Nombre de Objetos Cercanos

var texto : TextMesh; //creamos un 3dText y lo ponemos como hijo del player

function Update () {

if (Input.GetKey("e")) //si mantenemos pulsado "e"...
{
var hit : RaycastHit;
if (Physics.Raycast (transform.position, transform.forward, hit, 4)) { //lanzo un rayo hacia adelante
if (hit.collider.tag == "Leible") // si choca el rayo con algo marcado como leible (creamos el tag Leible)
{
texto.text = hit.collider.name; // aplicamos el nombre del objeto al texto 3d
texto.gameObject.active = true; // y activamos el texto 3d
}

}
else
texto.gameObject.active = false; // si dejamos de chocar mirar al objeto o nos alejamos...
o
}
else
texto.gameObject.active = false; // si dejamos de pulsar la tecla ... no se muestra el texto
}


function Start() { // al empezar el juego el texto 3d se oculta
texto.gameObject.active = false;
}

jueves, 11 de agosto de 2011

Leer Toque de Pantalla Táctil y Zoom de Pellizco con 2 Dedos

function LeerToque()
{
if (Input.TouchCount == 1)
var touch : Touch = Input.GetTouch(0);
else if (Input.TouchCount == 2)
{
var touch1 : Touch = Input.GetTouch(0);
var touch2 : Touch = Input.GetTouch(1);
var vectorDifActual : Vector2 = touch1.position-touch2.position;
var vectorDifAntiguo : Vector2 = (touch1.position - touch1.positionDelta)-(touch2.position - touch2.positionDelta);
var touchDelta : float = vecctorDifActual.magnitude - vectorDifAntiguo.magnitude;
}
}