0 Favourites

[PHYSICS] Gravity/antigravity

  • Hello,

    How I can simulate gravity attraction or inverse on a object by many planets, depending by her mass :

    I have tried the rex gravitation plugin (behavior-gravitation-for-physics-behavior_t70521) but I can't do antigravitation (negative force) and Yann algorithm (black-hole-physics_t66424?start=10) but I can't do many planets.

    Current event with rex gravitation plugin :

    The object is the BluePlanet and planets are GreenPlanet.

    Thanks in advance.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • I've made something like that one time. It's not a true solar system cause it's no using any physics behavior.

    Create three object : A sun , a planet and a mouse object.

    Add a behavior for the planet : bullet

    Now in the event sheet create a variable named "Attraction"

    We always need to set the planet perpendicular to the sun :

    Every ticks :

    planet set angle to Sun.X Sun.Y

    planet rotate 90 degrees conter-clockwise

    You can change the gravity by adding a "-Attraction" beside the 90 :

    planet rotate 90-Attraction degrees conter-clockwise

    You can add a event to change the attraction in game

    On mouse wheel down : substracte 0.1 to Attraction

    On mouse wheel up : add 0.1 to Attraction

    You can create different planet with different size.

    I know it 's like a fake solar system but i havent better.

    Maybe some expert will come soon to give you a better soluce (scirra have a good community

    Sorry for my english, i'm french so i wonder you will understand me x)

  • The problem is that my object isn't static, the object have an force on it, I want that the object path being affected by the planets attraction. Thanks anyway !

  • Current event added.

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