of     2   
chevron_rightchevron_rightchevron_right

AlternativeAcc
#141324603Wednesday, July 23, 2014 11:59 PM GMT

Im trying to make a camera effect, and it's not doing the CFrame.Angles part of the code. I need to have the second argument to CFrame.new as well as the CFrame.Angles. Here is the code: camera.CoordinateFrame = CFrame.new(workspace.Base.Position+Vector3.new(0,35,0),workspace.Base.Position)*CFrame.Angles(0,90,0) It doesn't rotate the Camera by 90 degrees on the Y-axis though, but does everything else.
deathknight306
#141324795Thursday, July 24, 2014 12:00 AM GMT

I believe its because roblox uses radians, not degrees. 90 degree in radians would be math.pi/2. camera.CoordinateFrame = CFrame.new(workspace.Base.Position+Vector3.new(0,35,0),workspace.Base.Position)*CFrame.Angles(0,math.pi/2,0)
AlternativeAcc
#141325430Thursday, July 24, 2014 12:07 AM GMT

Thanks, but it didn't help. It still doesn't rotate 90 degrees, or change the view at all. I want the view to rotate by 90 degrees, and also I have this in a RunService event so that the Camera is stuck on it.
deathknight306
#141325638Thursday, July 24, 2014 12:09 AM GMT

Apparently Im not sure then, I haven't worked much with cameras. Though I am almost positive you will need to use radians instead of degrees.
AlternativeAcc
#141325986Thursday, July 24, 2014 12:12 AM GMT

Oh ok, thanks. Do you know in general how to rotate the Camera 90 degrees in terms of what it is seeing though, like rotate the Camera in a birds eye view 90 degrees?
AlternativeAcc
#141330863Thursday, July 24, 2014 1:00 AM GMT

Bump
blockoo
#141332687Thursday, July 24, 2014 1:19 AM GMT

Is your CameraType set to Scriptable?
AlternativeAcc
#141333100Thursday, July 24, 2014 1:22 AM GMT

No, and the reason why is because when I set it to Scriptable the Camera points to a random spot instead of the base I want it to be looking at, and possibly moves too (not sure).
AlternativeAcc
#141333174Thursday, July 24, 2014 1:23 AM GMT

*didn't set to Scriptable
blockoo
#141333299Thursday, July 24, 2014 1:24 AM GMT

Setting the camera type to Scriptable makes the camera's CoordinateFrame exactly to the CFrame you set it, angles included. Using the Scriptable type in this case should work.
AlternativeAcc
#141335304Thursday, July 24, 2014 1:43 AM GMT

And why does it only work with the Scriptable CameraType? When I change it to Scriptable, it moves to a random spot and doesn't look at the part anymore. Why is that?
blockoo
#141335583Thursday, July 24, 2014 1:46 AM GMT

When you don't use the Scriptable camera type, the camera either relies on its Focus property or its Subject. If you want the camera to look at a part, you can use this template: YourCamera.CoordinateFrame = CFrame.new(cameraPosition, partPosition) You should set cameraPosition to be the point you want the camera to be at.
AlternativeAcc
#141335739Thursday, July 24, 2014 1:47 AM GMT

Oh ok thanks! Can you tell me why the Camera moves to a random spot and looks at a random spot with the Scriptable CameraType, because that's what's happening to me, either one or both, not sure.
Notunknown99
#141335967Thursday, July 24, 2014 1:49 AM GMT

Protip: X degrees = pi * X / 180 radians
AlternativeAcc
#141336211Thursday, July 24, 2014 1:52 AM GMT

Thanks, but I've confirmed that radians/degrees aren't the issue. Now my issue is that it changes to a random spot with the Scriptable CameraType :P.
Notunknown99
#141336321Thursday, July 24, 2014 1:53 AM GMT

workspace.Base.Position+Vector3.new(0,35,0), workspace.Base.Position You are trying to look straight down, and ROBLOX does not quite know what to do. Instead, what you should do is set the CFrame then rotate it straight down yourself.
AlternativeAcc
#141336725Thursday, July 24, 2014 1:56 AM GMT

Im not quite sure what you mean. You mean set the CFrame, and on a different line set the rotation? Like this: camera.CoordinateFrame = Blah blha blah (w/o CFrame.Angles) then camera.CoordinateFrame = camera.CoordinateFrame*CFrame.Angels(0,math.pi/2,0) I think this is the same as what I had anyways. Is this what you mean though?
Notunknown99
#141336851Thursday, July 24, 2014 1:58 AM GMT

CFrame.new(workspace.Base.Position+Vector3.new(0,35,0),workspace.Base.Position)*CFrame.Angles(0,90,0) CFrame.new(workspace.Base.Position+Vector3.new(0, 35, 0)) * CFrame.Angles(0, math.pi/2, 0) * CFrame.Angles(math.pi/2, 0, 0) --Also, add spaces. It makes everything a bit more readable.
AlternativeAcc
#141337261Thursday, July 24, 2014 2:02 AM GMT

Im super confused now. I think this is what I already had besides having 2 CFrame.Angles. Im not 100% sure it's the Y-axis that rotates the camera with birds eye view with CFrame.Angles either, this was just a guess, but I would imagine something to happen even if it's the wrong one, but I tried all 3 axis's and none of them seem to change the Camera in any way.
blockoo
#141337408Thursday, July 24, 2014 2:03 AM GMT

Using this: YourCamera.CoordinateFrame = CFrame.new(cameraPosition, partPosition) With the camera type set to "Scriptable" should work perfectly when you multiply it by the angles you want.
Notunknown99
#141337539Thursday, July 24, 2014 2:04 AM GMT

You had it where one vector was directly below another, causing the CFrame to try and point directly downwards (But there are an infinite number of possible CFrames for it to use, so it might get confused)
AlternativeAcc
#141338930Thursday, July 24, 2014 2:19 AM GMT

Im confused. So if I tell the code to point the CFrame at the same spot as the Vector Im positioning the CFrame at, it messes up and results pointing/moving to a random direction? I tried the code with both CFrame.Angles and got the same exact result.
blockoo
#141339019Thursday, July 24, 2014 2:19 AM GMT

Well, let's stop for a second here. Can you post exactly what you have right now?
Notunknown99
#141339158Thursday, July 24, 2014 2:21 AM GMT

No, the issue is that in order to point vertically there are an infinite number of possible CFrame values. But never, EVER use CFrame.new(a, a), as that will result in a lot of NaNs.
AlternativeAcc
#141339188Thursday, July 24, 2014 2:21 AM GMT

I still have the original code, as I'm unsure what to change to fix it. What specifically should I change from the original code?

    of     2   
chevron_rightchevron_rightchevron_right