I want the red part of the picture to slide along the ellipse and make sure it stays in the running direction.

I think of two ways：

1.build “walls” on the inner and outer sides of the ellipse, forcing the part to slide only in the middle.

2.calculate and modify the cframe of the part in each frame.

But both have obvious shortcomings, is there any better implementation?

I suggest using body force. Let’s say you wanted to rotate it clockwise, first, you would (assuming this is the top view) set the body force to say, (10, 0, 0), then you gradually increase/decrease positions.

This script would rotate it in a circle, but you can modify it to make it an eclipse:

```
local BF = --Bodyforce
while true do
for i = 1, 10 do
BF.Force = (10 - i, 0, -i)
wait(0.1)
end
for i = 1, 10 do
BF.Force = (-i, 0, -10 + i)
wait(0.1)
end
for i = 1, 10 do
BF.Force = (-10 + i, 0, i)
wait(0.1)
end
for i = 1, 10 do
BF.Force = (i, 0, 10 - i)
wait(0.1)
end
end
```

The parametric equations for an ellipse are:

```
x = a * math.cos(t)
y = b * math.sin(t)
```

Where `a`

is the semi-major axis, `b`

is the semi-minor axis,

and `t`

is the parameter between 0 and (2 * math.pi)

A polar equation, if you need it, would be

`r = math.sqrt((x ^ 2) + (y ^ 2))`

or with the original parameters:

```
cos2 = (math.exp(1) * math.cos(t)) ^ 2
r = b / math.sqrt(1 - cos2)
```

2 Likes

Thank you. What I want to know is, is there a way to have better performance while maintaining smooth sliding

Thank you. I’ll pay attention next time