Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- repeat wait() until Game.Players.LocalPlayer
- local p = game.Players.LocalPlayer
- local Mouse = p:GetMouse();
- local Ball = Workspace.Part1
- local cam = Workspace.CurrentCamera
- local A;
- local Button1Down = false;
- local AxisAngle = CFrame.fromAxisAngle;
- local VTOS = CFrame.new().vectorToObjectSpace;
- Mouse.Button1Down:connect(function()
- if (Mouse.Target) then
- if (Mouse.Target == Ball) then -- Make sure it buttondown'd on the Ball
- Button1Down = true;
- end
- end
- end)
- Mouse.Move:connect(function()
- if (Mouse.Target == Ball) and (Button1Down) then
- if not (A) then
- A = (Ball.Position - Mouse.Hit.p).unit;
- else
- local B = (Ball.Position - Mouse.Hit.p).unit
- local Axis = VTOS(Ball.CFrame-Ball.CFrame.p,A:Cross(B))--[[:vectorToObjectSpace(
- A:Cross(B)
- )]]
- Ball.CFrame = Ball.CFrame * AxisAngle(Axis, (Axis.magnitude))
- A = B;
- end
- end
- end)
- Mouse.Button1Up:connect(function()
- if (Button1Down) then
- Button1Down = false;
- A = nil;
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement