Ophic
|
  |
| Joined: 28 Dec 2013 |
| Total Posts: 25 |
|
|
| 20 Dec 2015 06:06 PM |
When a player uses the mouse wheel, I want their camera to rotate around a part. My script is sloppy and the camera can only rotate between two different positions, instead of 360.
repeat wait() until game.Players.LocalPlayer and game.Players.LocalPlayer.Character and game.Players.LocalPlayer:GetMouse() local target = workspace.Customization.CameraArena local camera = workspace.CurrentCamera player = game.Players.LocalPlayer mouse = player:GetMouse() camera.CameraType = Enum.CameraType.Scriptable camera.CameraSubject = target
mouse.WheelBackward:connect(function() camera.CoordinateFrame = CFrame.new(target.Position) * CFrame.Angles(0, -1, 0) * CFrame.new(0, 0, 15) end)
mouse.WheelForward:connect(function() camera.CoordinateFrame = CFrame.new(target.Position) * CFrame.Angles(0, 1, 0) * CFrame.new(0, 0, 15) end)
|
|
|
| Report Abuse |
|
|
Ophic
|
  |
| Joined: 28 Dec 2013 |
| Total Posts: 25 |
|
|
| 20 Dec 2015 06:08 PM |
| Any help would be appreciated. :) |
|
|
| Report Abuse |
|
|
Ophic
|
  |
| Joined: 28 Dec 2013 |
| Total Posts: 25 |
|
| |
|
Ophic
|
  |
| Joined: 28 Dec 2013 |
| Total Posts: 25 |
|
| |
|
Casualist
|
  |
| Joined: 26 Jun 2014 |
| Total Posts: 4443 |
|
|
| 20 Dec 2015 06:18 PM |
repeat wait() until game.Players.LocalPlayer and game.Players.LocalPlayer.Character and game.Players.LocalPlayer:GetMouse() local target = workspace.Customization.CameraArena local camera = workspace.CurrentCamera player = game.Players.LocalPlayer mouse = player:GetMouse() camera.CameraType = Enum.CameraType.Scriptable camera.CameraSubject = target
mouse.WheelBackward:connect(function() camera.CoordinateFrame = CFrame.new(target.Position) * CFrame.Angles(0, -math.rad (1), 0) * CFrame.new(0, 0, 15) end)
mouse.WheelForward:connect(function() camera.CoordinateFrame = CFrame.new(target.Position) * CFrame.Angles(0, math.rad (1), 0) * CFrame.new(0, 0, 15) end) |
|
|
| Report Abuse |
|
|
Ophic
|
  |
| Joined: 28 Dec 2013 |
| Total Posts: 25 |
|
|
| 20 Dec 2015 06:22 PM |
| Thanks for replying, Casualist. However, that doesn't work either. It's still only rotating between two positions. |
|
|
| Report Abuse |
|
|
XIPokezIX
|
  |
| Joined: 24 Sep 2015 |
| Total Posts: 381 |
|
|
| 20 Dec 2015 06:24 PM |
repeat wait() until game.Players.LocalPlayer and game.Players.LocalPlayer.Character and game.Players.LocalPlayer:GetMouse() local target = workspace.Customization.CameraArena local camera = workspace.CurrentCamera player = game.Players.LocalPlayer mouse = player:GetMouse() camera.CameraType = Enum.CameraType.Scriptable camera.CameraSubject = target
mouse.WheelBackward:connect(function() camera.CoordinateFrame = cam.CoordinateFrame*CFrame.new(target.Position) * CFrame.Angles(0, -math.rad (1), 0) * CFrame.new(0, 0, 15) end)
mouse.WheelForward:connect(function() camera.CoordinateFrame =cam.CoordinateFrame* CFrame.new(target.Position) * CFrame.Angles(0, math.rad (1), 0) * CFrame.new(0, 0, 15) end) |
|
|
| Report Abuse |
|
|
|
| 20 Dec 2015 06:25 PM |
repeat wait() until game.Players.LocalPlayer and game.Players.LocalPlayer.Character and game.Players.LocalPlayer:GetMouse() local target = workspace.Customization.CameraArena local camera = workspace.CurrentCamera player = game.Players.LocalPlayer mouse = player:GetMouse() camera.CameraType = Enum.CameraType.Scriptable camera.CameraSubject = target
local a=1 --angle mouse.WheelBackward:connect(function() camera.CoordinateFrame = CFrame.new(target.Position) * CFrame.Angles(0, -math.rad (a), 0) * CFrame.new(0, 0, 15) a=a+1 end)
mouse.WheelForward:connect(function() camera.CoordinateFrame = CFrame.new(target.Position) * CFrame.Angles(0, math.rad (a), 0) * CFrame.new(0, 0, 15) a=a-1 end) |
|
|
| Report Abuse |
|
|
Ophic
|
  |
| Joined: 28 Dec 2013 |
| Total Posts: 25 |
|
|
| 20 Dec 2015 06:28 PM |
| That doesn't focus on the target. |
|
|
| Report Abuse |
|
|
XIPokezIX
|
  |
| Joined: 24 Sep 2015 |
| Total Posts: 381 |
|
| |
|
Ophic
|
  |
| Joined: 28 Dec 2013 |
| Total Posts: 25 |
|
|
| 20 Dec 2015 06:30 PM |
| @101 Moving the wheel forward now works, but moving it back resets the position. |
|
|
| Report Abuse |
|
|
|
| 20 Dec 2015 06:30 PM |
local player=game.Players.LocalPlayer local mouse=player:GetMouse() local target = workspace.Customization.CameraArena local camera = workspace.CurrentCamera camera.CameraType = Enum.CameraType.Scriptable camera.CameraSubject = target
local a=1 --angle
camera.CoordinateFrame = CFrame.new(target.Position) * CFrame.Angles(0, math.rad (a), 0) * CFrame.new(0, 0, 15) mouse.WheelBackward:connect(function() camera.CoordinateFrame = CFrame.new(target.Position) * CFrame.Angles(0, math.rad (a), 0) * CFrame.new(0, 0, 15) a=a+1 end)
mouse.WheelForward:connect(function() camera.CoordinateFrame = CFrame.new(target.Position) * CFrame.Angles(0, math.rad (a), 0) * CFrame.new(0, 0, 15) a=a-1 end) --That one should work better |
|
|
| Report Abuse |
|
|
Ophic
|
  |
| Joined: 28 Dec 2013 |
| Total Posts: 25 |
|
|
| 20 Dec 2015 06:30 PM |
| @X You left out the target.Position |
|
|
| Report Abuse |
|
|
Ophic
|
  |
| Joined: 28 Dec 2013 |
| Total Posts: 25 |
|
|
| 20 Dec 2015 06:31 PM |
| Ok, thanks 101! It works now! |
|
|
| Report Abuse |
|
|
| |
|