I'm not really good when it comes to vectors or anything involving animation in general in .lua, sorry!

This was a code section part of POOPENGUIN's turret framework, but Motor6D allows for the variable of unanchored base parts while still being allowed to rotate freely instead of Cframe.

--In general, I need to convert this from Cframe to Motor6D. Pretty vague huh

while rs:Wait() do aimpos = mouse.Hit.p if (aimpos-gun.base.Position).magnitude>3 then

local c = aimpos
local x = (gun.gun:GetPrimaryPartCFrame()*CFrame.new(0, 0, -100000)).x
local y = (SPAWN*CFrame.new(0, 0, -100000)).y
local z = (gun.gun:GetPrimaryPartCFrame()*CFrame.new(0, 0, -100000)).z
A = Vector3.new(x,y,z)
if c then
	gun.gun:SetPrimaryPartCFrame(CFrame.new(gun.body:GetPrimaryPartCFrame().p,c))
	gun.body:SetPrimaryPartCFrame(CFrame.new(SPAWN.p,A))
else
	gun:SetPrimaryPartCFrame(gun.body:GetPrimaryPartCFrame())
	gun.body:SetPrimaryPartCFrame(CFrame.new(SPAWN.p,A))
	end
end

end

1 comment

0

Do you really need to put those short parameters on new lines?