Hi all
I've been prototyping a hot-air balloon sim over the past few weeks, built entirely with Playmaker. It all works really nicely, except I've had this issue I mostly ignored as I thought it was probably just a simple fix and would work itself out in time. But as I decided to look deeper into it the past few days, I seem to have found the culprit.
I posted a very indepth explanation of what is occurring on the TIGSource Forums (
https://forums.tigsource.com/index.php?topic=57603.0) yesterday, but at that point hadn't made the key discovery, so I won't replicate it all here.
My balloon is constructed from rigidbodies and joints, with AddForce used to apply vertical and horizontal movement. The player can move around inside the cabin during flight. The problem is that occasionally, but consistently, the balloon seems to glitch or jump, the physics go wonky for a brief moment, and the player is suddenly outside of the balloon, falling.
Looking at the profiler, I've identified that this glitch
always occurs during a huge spike associated with FsmLog.LogEvent()/GC.Collect, ranging from 40ms to as high as 250ms. This occurs roughly every 20 seconds, though sometimes more frequently. In the frame immediately after the spike, the Physics section of the profiler notes that about half of the active rigidbodies become inactive, and go to sleep, and then recover in the frame after. I believe that this GC.Collect spike causes the glitch in the physics system, in turn causing the physics hiccups in game.
I read in a thread on this forum (
http://hutonggames.com/playmakerforum/index.php?topic=5180.msg24731#msg24731) that UGUI was causing similarly large spikes for another user, and I do use it quite extensively, but I've completely disabled all UGUI elements in the scene, and all the associated Playmaker FSMs, and it makes no difference. All the screenshots and videos I've posted are with it all completely disabled.
If anyone could provide any guidance as to how to fix/get around this issue, I'd appreciate it!
I've attached the key image to the post, but there's also a load more here:
http://imgur.com/a/IrBvG
Here's a video showing the player ejecting at the exact moment of the spikes:
https://youtu.be/-lnT2sLq3DYWatch for: 0:10, 0:30, 0:50.