How do you make an object rotate around an object?

I’m just asking because i think i will need it in my next project.

1 Like

check out the orbit example www.flowlab.io/examples

3 Likes

thanks! helps a lot

@Cuts_ups, let me know if there is any confusion on how the orbit bundle works.

1 Like

is here any easier way to do it without using expressions?
(I never learned how to use expressions)

Expressions?
You should only need to input the numbers you need into the bundle to control everything about the orbit.

If your asking about inside the bundle, yes the expressions are needed to use the math for the orbit to work.

https://flowlab.io/game/play/1551636

image
XD

the whole orbit thing

I can break it down for what each part does, just dont ask me on why he used Cos and Sin.

Is there just an easier way to do it like for example attach the rotating object to the object you want to make it rotate around

I still don’t understand what your saying.
This is a bundle with many different inputs that you can use to control the orbit.

The 5 inputs is the (all needing a single input)

  1. starting angle of the orbit
  2. Speed of the orbit.
  3. Distance away from the center
  4. Center X
  5. Center Y

what if I want those two objects to be in 1 object?

Attach would just make it stick to the center.
Instead you just input the X and Y of the object you want to rotate around into the bundle.

I still dont understand what you mean, what do you mean by IN?
what 2 objects? in what other object?

like for example the sun and the arrow in the orbit example to be 1 object
could I do that?

No… unless you want to make a fake orbit…
The arrow is orbiting independently from the sun.

Making it a single object would just be rotating the sun because the arrow is also part of the sun.

I actually just found a way to make fake orbit using only 3 blocks of code. Even though it’s fake, it works about as well as it does in the example only with a few problems.

I think it would be easier to use the bundle, unless you have limited amount of objects with a free account. Which is what I’m guessing is what your saying.

I extended the code for the orbit and my own way on it seems to work just fine. Just for this game though. I don’t think the stradegy would be very useful on any other of my games.

ok, I worked on it some more and got perfect orbit. I think I just found the easiest way to make orbit.

I had my own way of making orbit