Bookshelf icon indicating copy to clipboard operation
Bookshelf copied to clipboard

`bs.environment`: get the moon phase

Open TretinV3 opened this issue 3 years ago • 5 comments

Put the rotation of an armor stand/other so that it looks/points at the sun/moon

TretinV3 avatar Aug 07 '22 08:08 TretinV3

There is already 3 ways to make it:

  • Without Glibs: roate the armor_stand and TP the other one locally at the same position in a loop (using ^x ^y ^z coordinates). THen the second one will appear to orbit around the first one.
  • Using the link module, which is basically the same, but it allow to adjust the distance, the angle etc. in short, you have better controle on the movement. To do so, you have to link the second entity to the first one using glib.link:create_link_ata and then run in a loop glib.link:keep_local_location. ⚠️ My last tests on this module showed some bugs, so maybe it will not work properly.
  • Using glib.vector and glib.move modules to create a realistic (but also very complex) gravity. You can define an initial vector for the second entity wich represent the tangential speed, define a mass for the two objects (or only the second one if you want the first one to be fixed) and then in a loop, you apply the gravity formula to simulate the acceleration : v = G*M/r^2 * s (with v the new speed vector, G the gravitational constant, M the mass of the attractive body, r is the distance vector between the two objects and s is the time spent before the last actualisation, so 1 tick, so 0,05 second). Once you have this new vector v, you add it to the previous one and you apply the movement using glib.move:by_vector

Good luck! 🤣

If you want help, do not hesitate to ask! ;)

VForiel avatar Aug 07 '22 09:08 VForiel

I don't want gravity I want an observatory

TretinV3 avatar Aug 07 '22 09:08 TretinV3

Oh ok, sorry I read too fast haha ^^'

VForiel avatar Aug 07 '22 10:08 VForiel

@ascpial got another idea to create a real astronomy module: being able to get the phase of the moon

VForiel avatar Aug 13 '22 22:08 VForiel

We will do:

  • Moon phase detection
  • Rotation to the moon or sun

theogiraudet avatar Apr 06 '25 12:04 theogiraudet