I have had a difficult time understanding the concepts that have been presented while searching for the answer to this, such as using quaternions. I have no idea how to apply them. Any help would be highly appreciated.
This is ripped in its entirety from the Roblox wiki article "Springs", just edited to be used with rotation.
local rs = game:GetService("RunService")
local cc = workspace.CurrentCamera
local spring = {}
function spring.new(current, velocity, target)
local self = setmetatable({}, {__index = spring})
self.current = current
self.velocity = velocity
self.target = target
self.k = 1
self.d = 1
return self
end
function spring:update()
local x = self.target - self.current
local f = x * self.k
self.velocity = (self.velocity * (1 - self.d)) + f
self.current = self.current + self.velocity
end
local part0 = Instance.new("Part", workspace)
part0.Anchored = true
part0.CanCollide = false
local part1 = Instance.new("Part", workspace)
part1.Anchored = true
part1.CanCollide = false
local new = spring.new(part0.Orientation, Vector3.new(), part1.Orientation)
new.k = 0.5
new.d = 0.5
rs.RenderStepped:connect(function()
new.target = part0.Orientation
new:update()
part0.CFrame = cc.CFrame
part1.CFrame = part0.CFrame * CFrame.new(-2, -2, -5)
part1.Orientation = new.current
end)

5 comments
gimbal locking? Isn't that just restraining an axis for rotation? I feel like I can help, you just need to be a bit more specific. Do you want it to travel freely in all directions?
I'm not even sure if gimbal locking is the correct term, I'm not well informed on this sort of stuff. Basically whenever any of the axes reach 180/-180 it flips. Free rotation in all directions is pretty much what I'm looking for, yes.
OHH, Ok, give me a minute.
Sure.
if you need, Ill do it when im off work today.