Besiege

Besiege

Not enough ratings
Level Editor: Orbit Transformation
By Nice Name
Orbit Transformation is a movement about an object orbiting a set pivot.
   
Award
Favorite
Favorited
Unfavorite
Basics of "Orbit Transformation"
Usually, OT is about an object orbiting a set pivot or point. While Besiege doesn't allow us to do it with one logic only, we need to come up with a new logic pattern to accomplish so.

There are 3 steps in total: "Centering, Rotating, and Returning".


Centering
To move the object towards the pivot.

In this step, we need to know how much the distance and the direction are while centering the object, two values must be an actual number.


Rotating
Literally meaning Rotating the object.

Since OT is instantaneous, the larger the rotation angle is, the faster the object orbits.


Returning
Returns the object to the original distance away from the pivot, with the direction based on how much "Rotating" has turned.


To be more specific: After Rotating, the direction the object faces has changed, then we undo the "Centering" so that the object will be moved back to the orbit route, then the whole process will appear to be just like "orbiting the pivot".
Logics
When you're trying to move an object to orbit a set pivot, there are 2 different situations you might encounter:

1. An ObjectA besides the pivot.

2. An ObjectB besides the pivot but angled.

ObjectA

So, for the first situation, we need to "move the ObjectA towards the pivot, rotate it and then move it back to the original orbit route", and all these movements must be done instantaneously.

Here's example you can check out:

Orbit Transformation Example


The red one(ObjectA) is located on the left side of the pivot for 10m, in this case, the logic will be like:

On Level Starts
 Transform(local) "x= 10" (Centering.)
  Transform(local) "y=1°" (Rotation.)
 Transform(local) "x= -10" (Returning.)
 Repeat infinitely (adding this logic or not depends on how you design the logic.)

Image

Two important things is that they both must be"instant transformation" and in "local mode". And that's it for the first situation, isn't that easy?

ObjectB

Now let's see what we can do to the second situation, an object that is beside the pivot but angled, we will call it "ObjectB" which is the green one in the example level.

The logic in ObjectB is just like the ObjectA, but it's on the right side of the pivot for 10m and self-angled for 45 degrees.


To deal with that, we will need to add 2 extra logics in the beginning and the end to adjust the angle. it should be look like this:

On Level Starts
 Transform(local) "y= -45°" (new)
  Transform(local) "x= -10"
   Transform(local) "y=1°"
  Transform(local) "x= 10"
 Transform(local) "y= 45°" (new)
 Repeat infinitely

Image


Conclusion
To do the OT, we need to know the exact distance and the direction from the object to the pivot, so we could complete the three steps.

And that's it. It's totally fine if you still don't understand, you can always contact me here in the description.

Video of How you move a level object around a set pivot.