Hi, I’m a rookie. I’m soo lost. We have a unity and I have to adapt a visualization of a 3D model in android from pc version,I do the xportacion and almost everything works fine. It works the option to rotate the model, the moving planes of the model.
Fails in the two options that are moving camera, zoom and move.
The move has to do it by clicking and moving the finger and zoom in and out by moving the finger.
Mi update is:
void Update () {
if(camara != null){
if(m_seleccionado == 0)
camara.controlPropio=true;
else if(Input.GetMouseButton (0)){
switch(m_seleccionado){
case 1:
camara.controlPropio=false;
camara.mover(Input.GetAxis(“Mouse X”),Input.GetAxis(“Mouse Y”) );
break;
case 2:
camara.controlPropio=false;
camara.rotar(Input.GetAxis(“Mouse X”),Input.GetAxis(“Mouse Y”) );
break;
case 3:
camara.controlPropio=false;
camara.zoom(Input.GetAxis(“Mouse Y”) );
break;
}
}
}
if(ejes != null ((Input.GetKey(KeyCode.LeftAlt) || m_seleccionado == 4) Input.GetMouseButtonDown (0) )){
ejes.OnClick();
}
if(modelos != null m_seleccionado == 0 Input.GetMouseButtonDown (0) isPantalla(Input.mousePosition)){
modelos.OnClick();
}
}
public void setSeleccionado(int seleccion){
m_seleccionado = seleccion;
}
public int getSeleccionado(){
return m_seleccionado;
}
funccions:
public void zoom(float valor){
distancia -= valor * Time.deltaTime * velocidadZoom * Mathf.Abs(distancia);
distancia = Mathf.Clamp(distancia, minDistancia, maxDistancia);
}
public void mover(float x, float y){
objetivo.rotation = transform.rotation;
objetivo.Translate(Vector3.right * -x* velocidadPan);
//
objetivo.Translate(transform.up * -y* velocidadPan, Space.World);
}
Thanks