Orbit

0 favourites
From the Asset Store
With simple one-touch controls and vibrant graphics, the goal is to orbit as many planets as possible to achieve the hig
  • Hello. I am testing out this new orbit behaviour. It's good.

    If I have one ball with a drag and drop and when I move it closer to another ball I want it to orbit.

    This is tricky because < than x, or > than x won't work because the ball only starts it orbit at certain places around the main ball.

    Basically, how do you make the ball go into orbit if its 30 px away from the main ball. This needs to work at a 360 degrees.

    I have looked and only found construct forums from 2014, and even then most where using physics behavior.

    The answer is is maths, but I dont know the best way to write it.

    Thanks for any help.

    Tagged:

  • Line of sight maybe?

  • That's actually a great idea!

    Thanks newt

  • Nah still stuck lol

  • Post a cap I guess.

  • try this tutorial Ellpitical Orbit its a old c2 tutorial but for sure will work on your end.

    basically is using Cos() and sin()

    and this is the 2nd circular/eliptical motion one but might be a bit complicated. cause it has to many variables.

    but to rotate a object around a point u basically calculate it like this

    position x centerX + cos( A*B ) * circumferenceX

    position y centerY + sin( A*B ) * circumferenceY

    centerX and centerY are like for example the position of a planet you want a moon to spin around it.

    curcumferenceX and circumferenceY will make the circular motion change around a 3d plane of sorts(it moves in a 2d plane but altering live the values of A*B and circumferenceX or Y it will make it look like is a 3d sphere - very similar to the 2nd tutorial i linked). if u make circumeferenceY less than circumferenceX ul see it go on a smaller Y motion while keeping same X width motion.

    cos(A*B) and sin(A*B) calculates moons position relative to the position of the planet in degrees * circumferenceX or Y (not sure if i explained it the right way but that's how i understand it).

  • Thought you said you were bad at math! Your like mat Damon in goodwill hunting. Thanks man. I will try and get bac k to you👌

  • lol ... i wish .... nah im really bad at math ... but some of the expressions we use in Construct i use them very often so i sort of understanding them in my own way.

    Anyway the above examples should help you understand the elliptical motion, whenever u want a circle movement u use cos() for X and sin() for Y.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • lol ... i wish .... nah im really bad at math ... but some of the expressions we use in Construct i use them very often so i sort of understanding them in my own way.

    Anyway the above examples should help you understand the elliptical motion, whenever u want a circle movement u use cos() for X and sin() for Y.

    Sorry bud, but where do i put these expression?

  • You need to use the values to adjust the sprite object position that will move around in a circle.

    here is my orbit example | test it live

  • You need to use the values to adjust the sprite object position that will move around in a circle.

    here is my orbit example | test it live

    Thanks bro, that is really good and works so well.

    However if i try to add any drag and drop behaviour or touch, the moon just stops.?

  • I made a little example with the orbit-behavior. You can release or catch the planet from the the orbit.

    drive.google.com/uc

  • I made a little example with the orbit-behavior. You can release or catch the planet from the the orbit.

    https://drive.google.com/uc?export=download&id=1mcfon8OE0jJajeW9meYQFDwn7VZiTK7f

    Thank you. I kinda got it working with the math George used and then I added the orbit.

    I look forward to checking this out though, it's been quite tough. I will report back. Thanks kindly

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