Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: jonathangersam on May 04, 2013, 06:08:37 AM

Title: Stutter on iTween Rotate Update
Post by: jonathangersam on May 04, 2013, 06:08:37 AM
Hi,
Please help, I'm following some excellent video tutorials but there's one I'm having issues with:


Source:
YouTube's Hutong Games channel: "07 - First and Third Person Cameras"
http://www.youtube.com/watch?v=ykah5VSdP7E (http://www.youtube.com/watch?v=ykah5VSdP7E) (time: 15:18 - 20:40)


Problem:
Camera tracking of object using iTween Rotate Update produces stutters, which aren't in the video tutorial.


Setup:
Unity ver 4.0.1f2;
PlayMaker ver 1.5.6.f3


Overview:
1) An object called "Space Ship" is being tracked by a camera; Position of the Camera is set via Get Position (of Space Ship) and set using Set Position. So far so good.
2) Rotation of the Camera is set using iTween Rotate Update, where the target rotation transform comes from object "Space Ship". Other parameters are Time=1.25, Space=Self.
3) Effect: when rotating the Space Ship, Camera lags a bit (which is intended) before catching up to the rotaion of the Space Ship. But there is visible stutter on the ship. I believe this is related to the Space Ship and Camera sync, because everything looks good on the Unity Scene Editor, no stutters there.


If you have any idea on how to prevent the stutters, would appreciate any help, thanks!


Best Regards,
Jon
Title: Re: Stutter on iTween Rotate Update
Post by: jeanfabre on May 09, 2013, 06:03:57 AM
Hi,

 Could it be because you are using a physics based target? if so, the camera needs to follow the target on the late update, not on the regular update.

bye,

 Jean
Title: Re: Stutter on iTween Rotate Update
Post by: jonathangersam on May 09, 2013, 12:21:33 PM
Yes, the target is physics-based; I'm using Add Force and Add Torque to move and rotate it.
Couldn't find a "late update" checkbox for the iTween Rotate Update.

Title: Re: Stutter on iTween Rotate Update
Post by: Lane on May 09, 2013, 12:37:16 PM
 Kind of of topic but what is late update and why would it be better here?
Title: Re: Stutter on iTween Rotate Update
Post by: jonathangersam on May 09, 2013, 12:54:06 PM
Hi Lane,
Though I'm not sure how to do it right in PlayMaker, from my previous project I've also fixed stutter issues using late update (had to code in C#)-


The target object needs to move during update() function, and the follow action of the camera should go in lateupdate() function. This is to guarantee they are properly synced. If the camera follow happens prior to the target movement, it could cause lag; even worse if their order of execution keeps changing, it would cause the stutter (one frame it may lag, the next it may suddenly rush up to keep up with the target).


The video tutorial that i had been following didn't seem to have this issue though, so it's really been bothering me for a while (From PlayMaker's site - [size=78%]http://www.hutonggames.com/tutorials_camera_motion_and_control.php (http://www.hutonggames.com/tutorials_camera_motion_and_control.php)[/size][size=78%]).[/size]


Some PlayMaker actions have Late Update as a toggle-able checkbox, but not here in the one I'm using (iTween Rotate Update).


Thanks!