How do I Control Gravity

0 favourites
  • 8 posts
From the Asset Store
Supports keyboard, mouse and gamepads. Supports several gamepads at once.
  • So I'm making a game where I want all the objects to interact with each other gravitationally. It seems to be working but for some reason even if I set the world gravity to zero the objects still fall to the bottom of the screen. Anybody know how to fix this our just a way to do this that won't cause this issue?

  • If you want certain objects not to move while using physics, you can set immovable to yes in the physics properties..

    If I didn't understand you question correctly, please rephrase..

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I want all the objects to move and attract each other like planets and such

  • When setting world gravity to 0, objects shouldn't fall, unless you have created events that make them do so..

  • In the how do I FAQ there is an example named "Simulating gravity affected orbits between celestial objects" (link) that sounds like what you are trying to achieve.

    You should check it out.

    For your issue, are you sure you haven't added an extra behavior to your object like "platform" alongside "physics" ?

    Are you sure you are setting the world gravity in a "On start of layout" event, or an event that is to be executed right away, and not some event awaiting for a user action or something ?

    To make sure, consider posting your capx so we can check it out further.

  • Ok I fixed that issue but if I want multiples of the same sprite to attract each other it doesn't work like they'll both just start moving in one direction

  • without seeing your events it's very hard to answer that question..

    Are you referencing the objects in the event?

  • Yes, I have sprite 1 apply force towards sprite1.y,sprite1.x and this method works but only if I use different sprite instead of the same one. Also on a bit of a different topic is there a way to move the character without it stopping the effect of gravity? Like if I wanted a rocket but while it moves or even when it stops moving itself forward it still drifts and is affected by gravity

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