0 Favourites

How do I Get an object to move around in a circle?

  • This is probably something very simple, but I'm not very experienced, so I'm not sure how to do this. I'd say that I'm somewhere in the upper range between a beginner and an Intermediate. I believe I know enough to understand any suggestions.

    Please!!! Thank you so much in advance!!!

  • I'm probably more of a beginner, so maybe this is bad advice ^,^ ;

    As I understand it, the thing you are trying to do can be solved with a bit of clever maths being used to create an offset.

    But my math is weak, and I suspect that approach is better suited to more code heavy environments, so instead, This is what I would do:

    Create an invisible sprite to serve as the radius, with it's origin and next image point being the distance between the two objects. Set this arm's position to the object you want to be rotated around and attach the rotating object to it's image point. Rotate the arm ( I think using Sine movement behaviour on the angle property would be the easiest way of getting this result, but I haven't tried that before.)

  • I'm probably more of a beginner, so maybe this is bad advice ^,^ ;

    As I understand it, the thing you are trying to do can be solved with a bit of clever maths being used to create an offset.

    But my math is weak, and I suspect that approach is better suited to more code heavy environments, so instead, This is what I would do:

    Create an invisible sprite to serve as the radius, with it's origin and next image point being the distance between the two objects. Set this arm's position to the object you want to be rotated around and attach the rotating object to it's image point. Rotate the arm ( I think using Sine movement behaviour on the angle property would be the easiest way of getting this result, but I haven't tried that before.)

    Sounds a biiit complicated, but I'll give it a shot!

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • The easiest way is to give the object two sine-behaviors. One has movement horizontal the other vertical.

    Both have sine, both have the same period time. Now set on only one the period offset to a quarter of the period time (If the period time is 4 set the offset to 1). Use the vertical or the horizontal with offset, depending on the direction you want the object moves (left or right). To change speed change period and period offset.

  • I made an example to test my idea

    rotator.capx

    an if you want it's angle to point forward:

    rotatorwithangle.capx

  • Asmodean, I like your idea for it's extra flexibility, you could subtly vary values and have very organic orbits, for example, nice!

  • It's not really my idea. I read it a long time ago here in the forum. But I didn't finde the thread anymore.

  • It's not really my idea. I read it a long time ago here in the forum. But I didn't finde the thread anymore.

    Thanks for that info! Wow I knew it was easy! Thanks a lot!

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