Camera movement decrease my fps

Hello!

Im working on a project that should always have a camera focusing to the Oso and Pinguino. When the Pinguina is near, it will focus between Oso and Pinguina, moving horizontally and moving to zooming out (Pinguino will be always in the middle).

In another script I created an hability that makes Oso jump:

  • RigidOso.AddForce (5, 10, 0, ForceMode.VelocityChange;

For any reasson, when Oso jumps and begins his fall, this character (only this character) falls in slow motion, like a FPS rate issue (only at Oso).

Looking for the problem I found that, only if I remove the last line of this code the issue will be solved:
- Camara.transform.position = new Vector3 (PosicionCamaraX, 3, ValorFadeZ);

But I need this camera movement.

Another clue:

At Oso’s Rigidbody, I’ve frozen Z position (Deep in a 2D game). If I let it free, it works. But if I lock it by code:

  • Update {Oso.transform.position = new Vector3(Oso.transform.position.x, Oso.transform.position.y, 3.0f); }
    It breaks again.
    Looking at Oso’s Z-coord. I see that jumping moves him a little bit in Z axis, I dont know why but probably this angle is what slows it’s fall. Gravity is y=-9.81.
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System;

public class CamaraMove : MonoBehaviour {

    public GameObject Camara;
    public GameObject Pinguino;
    public GameObject Oso;
    public GameObject Pinguina;
    public float ValorFadeZ;    //Pinguina-oso
    public float ValorZ;    //Pinguino-oso
    public float DistanciaPinguina;
    public float PosicionPinguino;
    public float PosicionOso;
    public float PosicionPinguina;
    public float PosicionFadePinguina;
    public float ContadorFadePinguina = 0;    //Contador para suavizar el cambio de camara
    public float PosicionCamaraX;


    void Start () {

    }

    void Update () {

        PosicionPinguino = Pinguino.transform.position.x;
        PosicionPinguina = Pinguina.transform.position.x;
        PosicionOso = Oso.transform.position.x;

        DistanciaPinguina = PosicionPinguina - PosicionPinguino;
        ValorFadeZ = PosicionOso - PosicionFadePinguina;
        ValorZ = PosicionOso - PosicionPinguino;

        if (DistanciaPinguina < 20) {    //PINGUINA CERCA
            if (ContadorFadePinguina < 1.0f) {
                ContadorFadePinguina += 0.5f * Time.deltaTime;
                PosicionFadePinguina = Mathf.Lerp (PosicionPinguino, PosicionPinguina, ContadorFadePinguina);
                ValorFadeZ = Mathf.Lerp (ValorZ, ValorFadeZ, ContadorFadePinguina);
            }
        } else {
            PosicionFadePinguina = PosicionPinguino;
            ValorFadeZ = ValorZ;
        }
        if (ValorFadeZ > -10f) {
            ValorFadeZ = -10f;
        }
        else if (ValorFadeZ <= -10f) {
            ValorFadeZ = ValorFadeZ / 2f + (-10f * 1f / 2f);
        }
        PosicionCamaraX = (PosicionFadePinguina + PosicionOso) / 2;
        Camara.transform.position = new Vector3 (PosicionCamaraX, 3, ValorFadeZ);
    }
}

Try changing Interpolate value in Rigidibody to Interpolateor or Extrapolate

It didn’t work. I just tried with “None”, “Interpolate” and “extrapolate”.
Extrapolate looks a little bit different, like having milimetric rollbacks while Oso falls.

Try keeping it at Extrapolate and move Oso falls movement to fixedupdate while keeping camera movement at LateUpdate

I’m trying with some combinations of “LateUpdate” and “FixedUpdate” and no one works =(