#Tryna make the teeth open and close without other axis' rotating
1 messages · Page 1 of 1 (latest)
here is script also yes its ai "local teeth = script.Parent
local top = teeth:WaitForChild("Top")
local topAttachment = top:FindFirstChildOfClass("Attachment")
local hingePos = topAttachment.WorldPosition -- fixed hinge position in world space
local chompSpeed = 2
local chompAngleDegrees = 30
local originalCFrame = top.CFrame
task.spawn(function()
while true do
local t = tick()
local angle = math.sin(t * chompSpeed * math.pi * 2) * math.rad(chompAngleDegrees)
-- Vector from hinge to part pivot in world space
local pivotToHinge = top.CFrame.Position - hingePos
-- Rotate this vector around hinge by angle about Z axis (local to hinge)
local rotation = CFrame.Angles(0, 0, angle)
-- New position for part pivot, rotated around hinge
local newPos = hingePos + (rotation * pivotToHinge)
-- Calculate new CFrame: rotated by angle around hinge, positioned so hinge stays at hingePos
local newCFrame = CFrame.new(newPos) * CFrame.Angles(0, 0, angle) * (top.CFrame - top.CFrame.Position)
top.CFrame = newCFrame
task.wait(1/60)
end
end)
"
currently using hingeconstraints
bro 😭
@slim pollen can i get help or naw?
anchor the bottom
if you cant do that
you could also set the top part mass to 0
but i need it to chase players
ok ill try
did it work?
Im not a scripter bro sry 😭
naw i think ill just make an animation
i animated it it worked @sturdy pivot