Physics behavior not paused when object time scale = 0

Bugs will be moved here once resolved.

Post » Tue Jun 10, 2014 3:49 pm

Closing as not a bug: it is documented that the physics behavior by default ignores dt unless you set it to framerate independent mode, and changing the timescale only affects dt.

The 'framerate independent' mode is not designed to be changed at runtime. If you still think there is an issue please report it only using one setting set on the start of layout.
Scirra Founder
B
402
S
238
G
89
Posts: 24,637
Reputation: 196,071

Post » Tue Jun 10, 2014 7:24 pm

Ashley wrote:The 'framerate independent' mode is not designed to be changed at runtime.


Because of that statement I suppose it is not a bug... however you might want to add that support because of the root reason where I was trying to pause individual objects at run time.

I am sure you have seen in the forums people talk about how to pause the game yet still have menus, dialogs, and other UI that takes full advantage of the C2 engine while the game itself is paused in the background.

This is exactly why I am changing the 'framerate independent' mode at run time. I want my physics objects to be as accurate as possible yet be able to pause them without setting the system wide timescale to zero which prevents my menus from using things like the "lite tween" plugin to implement "touch scrolling lists with momentum".

I have this working now because I can change the 'framerate independent' mode at run time but it seems that I have to set it on the first? physics object I added to the layout and then it applies to all the physics objects. So I have a function that does it to each physics object type in the layout so that it happens to hit whatever the first one was on that layout whenever I pause the game... this works, but apparently isn't designed to work according to your statement.

Let me know if I can help you in anyway (sample capx) if you are interested in adding this feature to allow people to pause the "game" but not the menus that popup during the paused game.
B
21
S
5
Posts: 196
Reputation: 1,984

Post » Tue Jun 10, 2014 8:58 pm

Setting the framerate mode is not a suitable mechanism to implement pausing. Either use framerate independent mode and it happens automatically, or disable the behaviors when pausing. If you think there is still a problem when not changing the framerate mode at runtime please make a new report.
Scirra Founder
B
402
S
238
G
89
Posts: 24,637
Reputation: 196,071

Post » Wed Jun 11, 2014 12:25 am

Ashley wrote:Setting the framerate mode is not a suitable mechanism to implement pausing. Either use framerate independent mode and it happens automatically, or disable the behaviors when pausing. If you think there is still a problem when not changing the framerate mode at runtime please make a new report.


1) The documentation says that the Framerate Independent mode isn't as accurate as the other mode. How much difference do think it really makes?

2) Disabling the physics behavior doesn't work (I tried it) because for example if the player, which has the physics behavior, is in the middle of a jump and I disable the behavior to pause ... when I unpause and re-enable it then the player just drops straight down instead of completing the jump. If I flip from Fixed to Frame independent mode when I pause and then back again when I unpause then the physics calculations continue where it left off when I paused and player completes the jump.

I am "tricking" C2 into freezing only the player, enemies, moving platforms, and other "play time" game elements (even physics behavior objects), yet still allow full C2 functionality during the "pause" for the game menus, dialogs, etc... I have tried all kinds of different ways to do it without causing some negative side effect (like #2 above), but the only way that works is 1) Disable Sine behaviors, 2) Set ALL physics objects to "Framerate Independent" and time scale to 0, and 3) disabling all events directly related to updating "play time" objects.
B
21
S
5
Posts: 196
Reputation: 1,984

Previous

Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 1 guest