|
| 05 Jul 2015 12:27 AM |
| Well hi. I need to limit the angle at which the camera can look up at, and so I'd like to know how to go about this. |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2015 12:34 AM |
| I feel like a top quality nub to be asking this. Oh well. |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2015 12:57 AM |
This is what I have right now. Works fine, the only problem is that it resets the camera instead of just decreasing it by how much extra angle there is (if that makes sense)
if c.CoordinateFrame.lookVector.Y>0.9 then local difference=c.CoordinateFrame.lookVector.Y-0.9 print(difference) c.CoordinateFrame=CFrame.new(Vector3.new(c.CoordinateFrame-Vector3.new(0, difference, 0))) end |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 05 Jul 2015 02:50 AM |
What does Difference print?
(I might not be able to help because I don't have as much experience in Camera Manipulation, but I'll try).
Enjoying your stay at the Scripters Forum? Join this! http://www.roblox.com/My/Groups.aspx?gid=2582784 |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2015 03:09 AM |
| I would tell you but Avast detected ROBLOX Studio as malicious and cleared all my Studio stuff saved to my PC, FML. |
|
|
| Report Abuse |
|
|
| |
|
Tynezz
|
  |
| Joined: 28 Apr 2014 |
| Total Posts: 4945 |
|
|
| 05 Jul 2015 03:33 AM |
I thought maybe
local cam=game.Workspace.CurrentCamera cam.Changed:connect(function() cam.CoordinateFrame=CFrame.new(Vector3.new(0,cam.CoordinateFrame.lookVector.Y,0)) end) |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2015 03:36 AM |
| That just makes it stuck inside the floor |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2015 03:40 AM |
I have also tried this, exact same problem. So I'm beginning to think it's something wrong I'm doing with the lookvectors, or something
if c.CoordinateFrame.lookVector.Y>0.9 then local difference=c.CoordinateFrame.lookVector.Y-0.9 print(c.CoordinateFrame.lookVector.Y) print(difference) c.CoordinateFrame=CFrame.new(Vector3.new(c.CoordinateFrame.X, 0.8, c.CoordinateFrame.Z)) end |
|
|
| Report Abuse |
|
|
| |
|
|
| 05 Jul 2015 05:51 AM |
This has an annoying bug, but the main concept is there:
local cam = workspace.CurrentCamera local maxAngle = 110
game["Run Service"].RenderStepped:connect(function () local curCFrame = cam.CoordinateFrame local curAngle = math.deg(math.acos(curCFrame.lookVector:Dot(Vector3.new(0, -1, 0)))) if curAngle > maxAngle then cam:TiltUnits((curAngle - maxAngle)/10) end end) |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2015 07:03 AM |
try CFrame.new() instead of Vector3.new() they make a huge difference...
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2015 03:38 PM |
@Kapit
"Vector3 expected, got userdata"
Thank you buildersteve
|
|
|
| Report Abuse |
|
|
|
| 05 Jul 2015 03:39 PM |
| Now all there is to do is to get the camera not to be stuck again, ;( |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2015 03:41 PM |
em, am sure u didn't do it correctly... I don't think u can do CFrame - CFrame... do this...
TheCFrame * CFrame.new(0, -difference, 0)
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2015 03:42 PM |
oops... meant * CFrame.Angles(0, -difference, 0) cos I think u said look UP not be POSITIONED up...
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2015 03:46 PM |
| I've already tried that. Same issue, the camera completely resets. |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2015 04:00 PM |
hmmm :/
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2015 04:03 PM |
| DrMathemathica (I think now he is MrNicNac) told me the solution a while ago, I will see if I can find it. |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2015 04:04 PM |
At least this question is less noobish than I thought. That would be great if you could find it.
Thanks for the help everyone |
|
|
| Report Abuse |
|
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 05 Jul 2015 04:34 PM |
This is your solution:
local Camera = workspace.CurrentCamera local RunService = game:GetService("RunService") local CameraThreshold_Theta = 60 local Abs = math.abs
RunService.RenderStepped:connect(function() local CameraPitch = math.deg(math.asin(Camera.CoordinateFrame.lookVector.Y)) if (Abs(CameraPitch) > CameraThreshold_Theta) then local DesiredAngleChange = (CameraPitch < 0 and math.abs(CameraThreshold_Theta + CameraPitch)) or (CameraThreshold_Theta - CameraPitch) Camera.CoordinateFrame = Camera.CoordinateFrame * CFrame.fromAxisAngle(Vector3.new(1,0,0), math.rad(DesiredAngleChange)) end end) |
|
|
| Report Abuse |
|
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 05 Jul 2015 04:35 PM |
| However, I'd just recommend making your own camera controls, because working like that with a ROBLOX camera type can just be unnaturally choppy. |
|
|
| Report Abuse |
|
|
|
| 05 Jul 2015 04:40 PM |
| Odd. Same problem again, my friend the camera gets stuck. |
|
|
| Report Abuse |
|
|