How do I make an object orbit?

0 favourites
  • 4 posts
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • My object void sucks other objects. These objects need to be absorbed and when they get too close, the object orbits around the void and then goes inside the void then getting destroyed. How do I do this?

  • This should give you a good starting point;

    scirra.com/forum/how-do-i-make-earth-rotate-around-the-sun_topic45633.html

    Then every time the object makes a full orbit, or x amount of time has passed, slowly decrease the distance until it collides with the object.

    I think you'd need to use delta timing to decrease the orbit, but if you store that rate in a variable, you'd also be able to increase the rate the object gets sucked in the closer it gets to the object it's orbiting. Which would make for a much better gravity effect.

    You could create a circle "gravity field" object and turn off its visibility, and use that to detect when an object has fallen into the object's gravity well. I think you'd need to pin the gravity field to the object you want to have gravity, and then resize it based on the mass of the object.

    Once your object collides with the gravity field, that's where you'd start the orbit away from the centre of your larger object, so you'll need to calculate the distance between the small object, and the centre of the larger object, and make that the point that the object starts orbiting.

    Hope that gives you some general direction.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This isn't pretty, but here's a variation with spiral. You just need to juggle the numbers to change the rate(s).

    SpiralTest.capx

  • really interesting spiral idea. I was looking for something similar to this

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