Planet Gravity

dmilinovichiiidmilinovichiii Member Posts: 620
edited November -1 in Tech Support
Does anyone know how to measure the distance between two objects so I could create a planet and have something pulled towards the planet faster the closer it gets?

Comments

  • HachikoHachiko Member Posts: 330
    Using magnitude. There's a really nice template made by firemaplegames, if I remember well, that's pretty easy to understand and should just be what you're searching for.
  • dmilinovichiiidmilinovichiii Member Posts: 620
    Ok. I'll try it. Thanks.
  • BarkBarkCoBarkBarkCo Member Posts: 1,400
    This demo doesn't accelerate faster based on proximity, but it could be modified to do so. It does demonstrate how to trigger movement when an object gets closer.

    http://gamesalad.com/game/play/67052
  • dmilinovichiiidmilinovichiii Member Posts: 620
    barkbark00 said:
    This demo doesn't accelerate faster based on proximity, but it could be modified to do so. It does demonstrate how to trigger movement when an object gets closer.

    http://gamesalad.com/game/play/67052

    Great! I'll see if I can modify it like you suggested.
  • quantumsheepquantumsheep Member Posts: 8,188
    Another way of doing it is to constrain a large invisible actor over your planet.

    Then when an object collides with the invisible actor, it makes the actort move towards the invisible actor's centre (and thus, the planet).

    I use it for black holes :D

    QS

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • dmilinovichiiidmilinovichiii Member Posts: 620
    Hachiko said:
    Using magnitude. There's a really nice template made by firemaplegames, if I remember well, that's pretty easy to understand and should just be what you're searching for.

    So does anyone know how I would find the magnitude? I'm in high school math so can you explain it in detail?
  • BarkBarkCoBarkBarkCo Member Posts: 1,400
    Look at the rule in my star actor.

    `magnitude( self.Position.X - game.VicX , self.Position.Y - game.VicY )`

    The above expression gives you the distance between the star's position and that of the planet which is constrained to "VicX" and "VicY"
Sign In or Register to comment.