# How would I make my viewmodel move in an infinity type loop

How would I make my viewmodel move in an infinity loop
Something like this.

1 Like

An easy way is to draw a Lissajous curve!!! Thought I would never get to talk about these!!

You should also check out the leminsicate of Bernoulli, or the lemniscate of Gerono !! They are similar to what you want–and just as cool!

Gerono’s lemniscate also has a parametrization given by a lissajous curve.

A simple parametrization for an “infinity sign” can be given by:
`x = a * cos(t / 2)`
`y = b * sin(t)`
`0 < t < 4π`if you are going to draw all points and do not want overlapping.
`-∞ < a < ∞`
`-∞ < b < ∞`

You might be looking for a curve with a lower amplitude, so try this:
`x = a * cos(t / 2)`
`y = b * sin(t) / 2`
`0 < t < 4π`
`-∞ < a < ∞`
`-∞ < b < ∞`

Here is a code example of a script inside a `Part` and the script will modify the part’s position to follow an infinity path.

``````local RunService = game:GetService("RunService")
local Part = script.Parent

local a = 10
local b = 5

local t = 0
local dt = 1 / 10

local function Draw()
local X = a * math.cos(t / 2)
local Y = b * math.sin(t)
local Z = 0

local CF = CFrame.new(X, Y, Z)

Part.CFrame = CF
t += dt
end

RunService.Heartbeat:Connect(Draw)
``````

5 Likes

Thank you so much! This is going to work so well!