- Home /
Why is my camera sticking and showing lag while using iTween to follow a rigidbody-actor?
I have a little sidescrolling camera powered by iTween, very simple in it's scripting - however I've noticed that once I actually start my character, the camera "sticks" in place for five-ten seconds before snapping to and following the character. The character is being moved through physics with a velocity-powered launch.
using UnityEngine;
using System.Collections;
public class CameraFollow : MonoBehaviour {
public Transform target;
// Update is called once per frame
void FixedUpdate () {
float cowX = target.position.x + 2;
float cameraZ = transform.position.z;
float cowY = target.position.y;
Vector3 move = new Vector3(cowX, cowY, cameraZ);
iTween.MoveUpdate(gameObject, move, 0.0f);
}
}
I know it is an old post, but I'm currently working with our camera movement and we also have lag issue.
So, I found your question. If you don't have an answer, maybe you can delete it, but if you did find a solution, could you answer your question, please?
@axCed - I don't know about this specific question, but often jitter and lag problems with cameras can be solved by moving code into LateUpdate() ins$$anonymous$$d of Update() or FixedUpdate(). Also it seems a bit strange to have this non-physics code in FixedUpdate(). It is possible the different in frame rate between FixedUpdate() and Update() might cause some sort of issue. Consider opening a new question with sample code that demonstrates your issue.
Answer by duongquangnam · Dec 18, 2016 at 02:50 PM
Try replace FixedUpdate to Update. I think it will work
Your answer
