Ever seen the lasers from Club Galaxy 6? https://www.roblox.com/games/30760985/Club-Galaxy
I'm attempting to remake them lasers. As they of course use CFrame with Radius. But I just cant seem to understand how hes making them go up and down so smoothly to the bear sync. They will move, but these are very choppy if they attempt to go back down. Help?
local function cLerp(p1,p2,percent)
local p1x,p1y,p1z,p1R00,p1R01,p1R02,p1R10,p1R11,p1R12,p1R20,p1R21,p1R22 = p1:components()
local p2x,p2y,p2z,p2R00,p2R01,p2R02,p2R10,p2R11,p2R12,p2R20,p2R21,p2R22 = p2:components()
return CFrame.new(p1x+percent*(p2x-p1x), p1y+percent*(p2y-p1y), p1z+percent*(p2z-p1z),
(p1R00+percent*(p2R00-p1R00)), (p1R01+percent*(p2R01-p1R01)),(p1R02+percent*(p2R02-p1R02)),
(p1R10+percent*(p2R10-p1R10)), (p1R11+percent*(p2R11-p1R11)), (p1R12+percent*(p2R12-p1R12)),
(p1R20+percent*(p2R20-p1R20)), (p1R21+percent*(p2R21-p1R21)),(p1R22+percent*(p2R22-p1R22)))
end
RenderStepped:connect(function()
if AllowMovement then
for _,v in next,Bases do
local Model = v[1]
local oldCFrame = v[2]
if Model and oldCFrame then
local zAngle = Model.PrimaryPart.Orientation.Z
print(zAngle)
if zAngle > (20-math.random(1,10)) then
zAngle = -Radius( Sound.PlaybackLoudness/120 )
end
local NewCFrame = cLerp(Model:GetPrimaryPartCFrame(), -- math.pi*2%360
Model:GetPrimaryPartCFrame()*CFrame.Angles(
0, -- rotate to its side
0,
zAngle ),--Radius(Sine(tick())*(Multiplier/2))),
.1)
Model:SetPrimaryPartCFrame(NewCFrame)
end
end
end
end)
