Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more..
    Dismiss Notice
  3. Dismiss Notice

Camera Makes Moving objects look like they're vibrate problem

Discussion in 'Editor & General Support' started by ConsidraGames, Nov 15, 2014.

  1. ConsidraGames

    ConsidraGames

    Joined:
    Dec 7, 2013
    Posts:
    10
    Hi I have a problem iv'e been working hours on.
    The Problem is that when my camera follows Object A, Object A appears on the camera just fine. but when
    Object B follows Object A, it moves fine but Object B appears to vibrate. Anyway to stop this vibration effect?

    Here's the code i use to move these objects(at least what i feel is the relevant part)

    Vector3 direction = (Path[0] - transform.position).normalized;
    Vector3 endpos;

    if(gameObject == GLOBAL.PLAYER2)
    {
    if(((GLOBAL.PLAYER1.transform.position - transform.position).magnitude > approachdistance))
    transform.position = Vector3.MoveTowards(transform.position, transform.position + direction, Time.deltaTime * 14F);
    }
    else
    if(gameObject == GLOBAL.PLAYER3)
    {
    if(((GLOBAL.PLAYER2.transform.position - transform.position).magnitude) < ((GLOBAL.PLAYER1.transform.position - transform.position).magnitude))
    {
    if(((GLOBAL.PLAYER2.transform.position - transform.position).magnitude > approachdistance))
    transform.position = Vector3.MoveTowards(transform.position, transform.position + direction, Time.deltaTime * 14F);
    }
    else
    {
    if(((GLOBAL.PLAYER1.transform.position - transform.position).magnitude > approachdistance))
    transform.position = Vector3.MoveTowards(transform.position, transform.position + direction, Time.deltaTime * 14F);//
    }
    }
    else
    transform.position = Vector3.MoveTowards(transform.position, transform.position + direction, Time.deltaTime * 14F);

    Thanks in advance
     
  2. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
  3. ConsidraGames

    ConsidraGames

    Joined:
    Dec 7, 2013
    Posts:
    10
  4. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    There are quite some people here in the forum (myself included) who don't answer questions without properly formatted code. It is extremely unreadable without any indentations.