Strange Animation Bug

Currently working on a windmill. There are two ways I am approaching this, the first method is to declare offset first, when I do this it works perfectly until the windmill moves, the second method is to update the offset as the object spins but this causes the object to slowly accelerate. Here is the code

local joint = Motor6D
local rootPart = joint.Part0
local startTick = tick()
local offset = joint.Part1.CFrame:Inverse()
while true do
	local x,y,z = rootPart.CFrame:ToEulerAnglesYXZ()
	z = z + (math.rad(1) *(tick()-startTick))
	local rootPartNewCFrame = (CFrame.new(rootPart.Position) * CFrame.fromEulerAnglesYXZ(x,y,z))
	 -- here is the part where I can replace joint.Part1.CFrame:Inverse() with offset.  Each of these work differently
	joint.C1 = joint.Part1.CFrame:Inverse() * rootPartNewCFrame * joint.C0
	RunSerivce.Heartbeat:wait()
end	
1 Like

Try looking into HingeContraints, it might suit your purposes. (Look at the first bullet point.)

Here’s a tutorial, but you will have to set other properties for the windmill to rotate.

https://developer.roblox.com/en-us/articles/Constraints-Revolving-Door

These are pretty simple it doesn’t help, currently I am not working with constraints I am working with a motor6D, cosntraints are good for simple builds but this one needs a more dynamic range of motion.

Managed to fix it, replacing it with z = z+.1 works since when you update c1 its already updated I forgot about that