How I Can Pet Movement Inverse Circle Position

How I Can Pet Movement Inverse Circle Position

I Want:

My Script:

My Code:

local radius = 10

local function getCirclePoint(ItemNumber,TotalNumber)
	return (ItemNumber * ((2 * math.pi) / TotalNumber))
end

local angle = getCirclePoint(i,#petsTable) 
		local position = (hmndrootpart.CFrame * CFrame.new(math.sin(angle) * radius, 0 , math.cos(angle) * radius))

  v.PrimaryPart.CFrame = position

what ? .-.-…-.-.-.-.-.-.-.-.-.-.

Try replacing this

With this

return (ItemNumber * ((math.pi) / TotalNumber))

Why?

180deg is math.pi,
360deg is math.pi*2,

image
again giving error

idk .-.-.-.-.–.-.-.-.-.-.-.-.-

Oh wait oops, do this

return (ItemNumber * math.pi)

(Only do this if your pets are 2 or below other wise use math.pi*2/total_pets)

local function getCirclePoint(ItemNumber,TotalNumber)
    if TotalNumber <= 2 then
           return (ItemNumber * math.pi)
    else 
          return (ItemNumber * ((2 * math.pi) / TotalNumber))
    end
	
end


.p again

local position = CFrame.new(hmndrootpart.CFrame * Vector3.new(math.cos(angle) * 5, 0, math.sin(angle) * 5))

image
image
only 2 position ??

I told you before.

three part problem
image

Hmmm thats weird :thinking:
working for me
image

Why are you using pi if your not wanting it to be in a circle.

It needs to be in circle.
pi = 180 degs (pets at left and right)
pi * 2 = 360 degs (pets in all directions)

This is not in a circle

sorry if im starting another argument

This is a circle, those pets are at 180 deg.
image

ohh sorry for interrupting.

1 Like

add three part bro .-.-.-.-.-.

local function getCirclePoint(ItemNumber,TotalNumber)
    if TotalNumber <= 2 then
           return (ItemNumber * math.pi)
    elseif TotalNumber == 3 then
           return (ItemNumber * (math.pi*1.5) / 3)
    else 
          return (ItemNumber * ((2 * math.pi) / TotalNumber))
    end
end

With 3 pets
image

image