- Home /
Top Down 3D moves in unexpected ways.
I'm trying to figure out how to make a 3D model in a top-down view face the right direction when moving in a non physic environment.
I tried something like this:
function Update (){
x = transform.position.x; //Trova la x dell'oggetto.
y = transform.position.y; //Trova la y dell'oggetto.
if(!dirsel){ //Controlla se la direzione c'è
xvart = Random.Range(-3,3); //Assegna un valore tra -3 e 3.
yvart = Random.Range(-3,3); //Stessa cosa a yvariation.
dirsel = true; //Conferma la selezione.
transform.LookAt(x+xvart, y+yvart,0); }
}
But the model lose it's top-down alignment. I'm really losing my mind on this, can someone help me?
Comment
Answer by Mold · Jul 14, 2012 at 12:02 PM
When doing top-down stuff, use the X and Z axis. Y is vertical.
Also don't expect people to understand comments if they'r written in Italian :/
Just c&p the code from the editor, i forgot to delete them. Ah yes, i am using the x/y axis to make it, with the camera facing the +Z axis.