cancel
Showing results for 
Search instead for 
Did you mean: 

Eye cameras jump around during update phase

jjoudrey
Honored Guest
FYI
I had attached an object to the right eye camera of an OVR character in order to mount it to the screen (not ideal, I know). This exposed some oddness. During the update of the object I mounted (a gun) the eye's camera would either be in it's true location, or another location beneath the player.

I presume this was caused by execution order. Once I moved critical behavior to LateUpdate everythnig worked fine.

I also presume this could be solved more efficiently with script execution order, but that investigation seemed like a lot of work for a problem that was already solved.

Has anyone else encountered "moving cameras" during their updates or have any insights as to why this might happen? I was thinking it was floor reflection, but my observations weren't always consistent with this.

Jesse Joudrey

Oh, check out the results of my efforts, Oculus Bots, an FPS based on the unity Angry Bots demo...

Download the demo (Oculus Rift Requried): http://bit.ly/ZUObHJ
Full Video: http://youtu.be/0Tmt7TMrKvY
Short Video: http://www.youtube.com/watch?v=yHqvgpcFhwc
Reddit: http://www.reddit.com/r/oculus/comments/1ccm9u/oculus_bots
4 REPLIES 4

cybereality
Grand Champion
Hey,

We were not able to reproduce this issue here in the office.

Would it be possible for you to upload a simple demo that illustrates the problem?

Thanks.

jjoudrey
Honored Guest
So my first answer is that yes it's a simple change to make to have it run the old way.

But my second answer is that the problem is no longer happening to me in a timely manner either.

Check out the oculus bots demo I linked in the first post.

Everything would be fine for the first little while, perhaps 10 or 20 seconds but shortly after destroying the first enemy (but not immediately after) the guns shots would start coming from under the floor. I placed a script on the camera that merely printed out any frame that the sign of the position's y coordinate flipped from + to - or back during it's update call and it was triggering once or twice a second.

Unfortunately it seemed as if the execution order was changing on the fly as game state changed. You can probably see why I gave up once I had a solution that was "good enough".

On the other hand the issue was detected only within a single long unity session, maybe it needed to be shut down.

Good luck (or maybe it never happens again...)
Jesse

drash
Heroic Explorer
Interesting. This just confirms the need for a better per-frame Update system in Unity! I had to go make my own layered updates system a while back in order to control execution beyond just using Update vs LateUpdate. Scripts for it are posted at http://blog.crunchywood.com/2013/03/improving-unitys-per-frame-update-system.html if anyone cares. 😛

jjoudrey
Honored Guest
Without some kind of dependency graph, it can be tough to get it all sorted out, for sure. And that solution totally sucks too.
Maybe some day we'll have frame-update based compilers that can automatically determine data propagation and order it effectively...

...I can dream!