playMaker

Author Topic: LateUpdate on camera cause choppy background, should I use?  (Read 2398 times)

ryf9059

  • Full Member
  • ***
  • Posts: 100
I read this unity doc regarding LateUpdate:
http://docs.unity3d.com/Documentation/ScriptReference/MonoBehaviour.LateUpdate.html

And it says camera should always use LateUpdate because tracking object might be moved inside update. My object is physics based so this should remain true for my case.

In addition, I have another object following the camera, which is a static object serving as background by using setPosition and getPosition of the camera.

So when I run, the tracked object should move based on physics and the camera follows the object and the background object follows the camera.

However, when running, the background object is bouncing. After all kinds of trial and error it turns out that if I un-check the LateUpdate of the camera the background object will then remain still. But even I have both the background object and the camera using LateUpdate the background will still be jumpy

My guessing for this is that the background object setPosition is called before moving the camera so the next frame it will have this jumpy effect. But I don't know how to adjust the order of FSM execution (I know I can adjust the order of script, but I don't know if I can do the same to the FSM).

Hence the LateUpdate doesn't work, unless I un-check the LateUpdate of camera, but I surely will need it later.

What option do I have to workaround this?

EDIT: By making the static background object a child of the camera the problem is automatically solved and I can use LateUpdate on camera, but that's not desired since I need to change the relative position of the camera regarding to the background object.

Thanks
« Last Edit: June 16, 2013, 04:08:04 AM by ryf9059 »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: LateUpdate on camera cause choppy background, should I use?
« Reply #1 on: June 17, 2013, 01:40:28 AM »
Hi,

 You should not need to mess with script execution order here.

Have you tried to make the camera the child of your background instead?


bye,

 Jean