Global gravity not behaving

0 favourites
  • 9 posts
From the Asset Store
Globals 2.0
$3.99 USD
Globals 2.0 stores and group variables. You can also load and save data (variables) from/to JSON files.
  • I'm having an issue where global gravity won't turn off.

    I was first aware of the problem in r112. At the time, despite having 'global gravity set to 0' littered in numerous locations in my code, the physics object in question would still be affected by gravity the first time it was spawned into the game. Every time afterward, the object would be unaffected by gravity. Now in 'r115,' I'm having the same issue.

    Continuing with the example of the gold coin, I have 'Gold Coin: Set Physics world gravity to 0' loading at the beginning of every single level, and I also have that same event running when each and every single gold coin is spawned into the world. Despite gravity being turned off (at least) twice for these objects, the objects first spawned into the game will fall, affected by gravity. All of the same objects spawned afterward behave without gravity, and do not fall.

    I would share the .CAPX to help the diagnosis of the problem, but it's massive. I can say that this bug seems to be affecting some objects that it did not previously in r112.

    The relevant events being used in this situation are:

    • Set Physics world gravity to 0
    • Spawn (physics object)
    • Apply Physics impulse (...) at angle (...)

    To reiterate, all objects with physics will fall, affected by gravity, when they are first spawned. Those same objects spawned again will be unaffected by gravity, as intended. Also, for top-down perspective games like mine that are the wrong perspective for gravity, can we have an event to disable gravity for all physics objects spawned into the game, and not just on an object-by-object basis?

    Once the new version is approved, the game in question will be available at:


  • Actually, on further observation, it looks like the physics objects fall a certain amount of times, not just one, before behaving. Sometimes, it takes the 2nd or 3rd time spawning the object before adjusting the gravity to zero.

  • So, this problem that has existed for five versions still exists with the latest version, Construct 2 R119. I'll try to replicate this problem with a clean project file, but the problem I'm getting now is exactly as I stated above: The first instance of a physics object behaves as affected by default gravity no matter if I turn off global gravity on the object or not. All/most times afterward it works as intended.

  • We cannot investigate issues without a .capx. Please provide one demonstrating the issue in a new project.


    Once I ran into a few other problems, I made a separate CAPX to address those problems. I attempted to address the problem I had of global gravity but, ironically, I couldn't recreate it. However, it does showcase the problems I'm having of collision data where the secondary collision detection sprite doesn't detect collisions and that, randomly, the rat will stop moving and the collision detection line will stop spawning.

    Also, I don't know if this is significant, but I had to set the Linear Dampening and Friction way over 1 in order to get them to behave correctly (for the barrel fragments). I'll continue work over here either to recreate the global gravity bug, or to squash it. In the meantime, however, this collision detection system and having monsters randomly stop moving seem to be beyond my power to fix.

    And this was created before Construct 2 introduced pathfinding. I prefer this system I have now in this particular scenario, though I would prefer it more if it were working again. Seems like this used to work before some of the new patches, though I can't speak to that for certain.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • So I just uploaded a tweaked version of my production tests map at:

    I would really love someone to tell me why it's not detecting the collision data of the secondary (now purple) collision data square until the rat is physically overlapping the barrel, please. For all of my testing, I haven't discovered why this might be. It's looking more and more like it's beyond my power to address.

  • Through experimentation, I've discovered that objects (my rats) have a difficult time spawning when part of a family compared to when they're not. The same trigger: "every 0.1 seconds, spawn rat1" will spawn rats 10x faster than the EXACT same trigger when the rats are part of a family 'monsters.' I feel that this is a legitimate problem within the editor, and is seriously undermining my ability to spawn monsters regularly and consistently.

    It's also making it impossible to spawn a collision sprite with each monster as the same commands running side by side will spawn 10 to 100 times MORE collision sprites (because they're not in a family) than the monster itself.

    And the reason the rate is so high is because I set a hard cap of the number of monsters spawned at any given time.

  • I don't see any evidence here that there's a Construct 2 bug and not just a mistake in your events. You might want to post in 'How do I' instead. Closing this report; please post as simple a project as possible to demonstrate a C2 bug if you believe there is one.

  • Here's another fun quirk I found: using the above method, I installed a mob counter to tell me how many rats were able to successfully spawn. Assuming a hard cap of 100 (for examples sake), the mob counter will tell me that there are 100 rats spawned after a short period of time--however, there will only be about 5 - 10 actual rats within the level. The rest are not outside the bounds of the level, nor covered up by obstructions or sprites. They're just simply not there. So now apparently the Rat1.count is lying/confused about the actual number of Rat1's there are. This is sure not making mob spawning easy for me...

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)