# Physically pushing something in a circle

Please take a moment to consider if this thread is worth bumping.

## Recommended Posts

There may be a time when you want to move physical object(s) around some point, for example like a tornado.

llPushObject can push things in a linear direction, as well as make them spin around themselves, but the physics system in Second Life is not complex enough to simulate air resistance in such a way that could make spinning objects with "curved" trajectories (besides vertically due to gravity).

So here's a pretty simple script that demonstrates how to make a series of pushes in such a way that the object appears to be pushed along a more complex path. It works by getting the direction of the target from the center-point, and pushing that target about 90 degrees to the side. When this is done repeatedly, you end up with a circle.

```default
{
touch_start(integer n)
{
key target = llGetOwner();
while (1)
{
vector dir = llList2Vector(llGetObjectDetails(target, (list)OBJECT_POS), 0);

dir -= llGetPos();  // Direction from source to target
dir.z = 0;          // Ignore height difference

dir *= llEuler2Rot(<0, 0, 90 * DEG_TO_RAD>);  // Rotate 90 degrees around Z
dir *= llGetObjectMass(llGetOwner());         // Adjust the push force according to the object's mass.

llPushObject(llGetOwner(), dir, ZERO_VECTOR, FALSE);
}
}
}```

Here's a visualization:

Note: This is a very simple scenario. In cases where the force is stronger, you'll find that the target is gradually getting pushed further and further way (kind of like a spiral). This is because we're just doing little nudges directed away from the circle. To account for that, we could rotate more/less than 90 degrees, like this:

Notice how the push direction is going back into the circle (towards the center-point) a little bit? This helps the object "stabilize" into some radius. I say "some radius" because without doing the math beforehand, it can be pretty hard to tell how the physics play out. If you push too far into the circle, you'll pull the target in and might even cause it to shoot past the origin and create an unstable ellipsis like this one:

• 3