Physics behavior not paused when object time scale = 0

Bugs will be moved here once resolved.

Post » Sat Jun 07, 2014 2:17 am

Problem Description
When the system event "Set object time scale" is set to zero for an object with the physics behavior (ALSO the Sine Behavior is not affected) the object still falls because the physics behavior is not affected.

** Note to devs: I thought we figured out how to fix it below, but then I found that if the solution (change to Framerate Independent mode) is applied to a sprite that isn't the first then the fix has no effect!!! So there might still be a bug here...

Attach a Capx
Done

Description of Capx
Press Right arrow to cause the physics object to fall off edge. Press space to see that the fall continues despite object time scale set to zero. Refresh and press Right to fall off edge again and press Ctrl to see the object stop falling when the entire system time scale is set to zero.

Steps to Reproduce Bug
  • Use the physics behavior on an object.
  • Put the object in a state of physics movement (falling)
  • Set object time scale to zero.

Observed Result
Physics behavior continues to operate.

Expected Result
Object to pause

Affected Browsers
  • Chrome: (YES)
  • FireFox: (don't know)
  • Internet Explorer: (YES)

Operating System and Service Pack
Windows 7 SP1

Construct 2 Version ID
Release 168
You do not have the required permissions to view the files attached to this post.
Last edited by ggibson1 on Sat Jun 07, 2014 5:38 pm, edited 5 times in total.
B
21
S
5
Posts: 196
Reputation: 1,984

Post » Sat Jun 07, 2014 2:34 am

There's nothing wrong. Setting time scale to 0 has no effect on physics in motion. I had the same issue in a game. If there is a way to pause an object n motion with physics, I'd like to know it.
Image
B
75
S
23
G
3
Posts: 673
Reputation: 9,293

Post » Sat Jun 07, 2014 2:36 am

Use the system event "set time scale" that pauses physics objects in motion, but it pauses ALL objects at the same time.

You can also use the physics event "disable" to turn physics behavior off and the object will stop dead in its tracks.
B
21
S
5
Posts: 196
Reputation: 1,984

Post » Sat Jun 07, 2014 2:40 am

When I use System time scale, doesn't work either. I never thought of disabling the physics. Thanks!
B
75
S
23
G
3
Posts: 673
Reputation: 9,293

Post » Sat Jun 07, 2014 4:54 am

Setting system time scale to zero definitely works... that freezes everything in the game... it is how Scirra examples show how to implement "pause" in a game.
B
21
S
5
Posts: 196
Reputation: 1,984

Post » Sat Jun 07, 2014 4:57 am

TheDom wrote:When I use System time scale, doesn't work either. I never thought of disabling the physics. Thanks!


If you look at the capx that I attached to this bug report you will see by pressing Ctrl that the system time scale gets set to zero and the physics stop.
B
21
S
5
Posts: 196
Reputation: 1,984

Post » Sat Jun 07, 2014 12:02 pm

If you set the physics stepping mode to 'Framerate independent' then you can set the object time scale.
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,680

Post » Sat Jun 07, 2014 2:43 pm

ramones wrote:If you set the physics stepping mode to 'Framerate independent' then you can set the object time scale.


Awesome answer Ramones!

I have attached a new capx that uses your suggestion and it now works!

It is not working in my game for some reason, but since this sample capx works it must be due to some other logic in my game... more work to do.

Thanks for the answer to this problem!
B
21
S
5
Posts: 196
Reputation: 1,984

Post » Sat Jun 07, 2014 3:30 pm

*** I just noticed something though... in the FIXED capx I added a second physics sprite... it pauses also even though I am not settings its time scale at all? How can that happen?
B
21
S
5
Posts: 196
Reputation: 1,984

Post » Sat Jun 07, 2014 3:48 pm

Ok so now I uploaded another capx "BrokeAgain" version...

This one just applies the "Fix" to the second physics sprite called "Box" and now the pausing has no effect again... strange.
B
21
S
5
Posts: 196
Reputation: 1,984

Next

Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 1 guest