I run into some problem of FSM and the script not being synced in a frame so it runs very choppy.
Here is my case:
I try to use a camera to follow a player, and a background that follows the camera and there are some scripting on the background so when the camera moves the background moves along with the camera, and with a little scripting I can achieve a parallax effect.
My approach:
Initially what I did is to use translate on the camera (the translation vector is the moving distance of the player), with fixed update selected (if not the camera will move slower than the camera and cannot follow). It works normally.
I then want to improve my method by using a camera target. And this time rather than using translate, I use get position of the camera target and then set the position on the camera itslef. It should work the same way theoratically, as I would have expect.
The results:
But the fact is that when running. The background is jumping left and right along the movement of the player.
I then investigated this issue and find out this might have something with the script I attached to the background. If I deselect the script, the background will stay still relative to the camera while the forground moves, that says, it works normally.
If I select the script and run again, the problem happens.
So I figure this has something to do with the execution order of FSM and scripts, that they have NOT been synced into the same frame.
Also, this problem happens intermitently (some case more jumpy and some case less) and the cause is unknown. It seemed totally random to me.
Any advise on why this problem will happen? Is it possibly related to the execution order os FSMs and scripts? Are they controllable?
P.S. There is an issue with my video card, it overheats itself and the game in general runs choppily, and I don't know if this has anything to do with it. Since no matter how choppy it is, the order should still be the same. It looks to be like the background script and the camera FSM is not executed in the correct order