C0D3Y
|
  |
| Joined: 24 Jul 2010 |
| Total Posts: 1692 |
|
|
| 21 Jun 2012 01:01 PM |
Okay, I'm new to this camera manipulation thing, but I think that my script should still work... The Focus property in the camera takes a CFrame, so when I say
local cam = workspace.CurrentCamera cam.Focus = workspace.Part.CFrame * CFrame.new(0,-15,0) cam.CoordinateFrame = workspace.Part.CFrame
It should work, correct? I am giving it a CFrame of where to look. And yet it does not look that way. I have a brick rotated so it's facing upwards, and when I use the script all I see is sky. I had created a brick using the same formula, so it should work. Yet, it does not... I even added this to the script:
wait(2) cam.Focus = workspace.Part.CFrame * CFrame.new(-15,0,0) print'Changed' wait(2) cam.Focus = workspace.Part.CFrame * CFrame.new(0,0,-15) print'Changed'
It prints changed, but the camera stays looking at the sky... Anyone have an idea of what I am doing wrong? No output BTW.
PS. Legokid135(Might have gotten the numbers wrong), your script didn't work, I just didn't want to bring up the old thread when this one has a different purpose. |
|
|
| Report Abuse |
|
|
|
| 21 Jun 2012 01:13 PM |
| Yeah, I'm having trouble with camera manipulation too. I was using the camera rotation effect, but whenever I try to get the camera to return to the player's humanoid, it does return, but the camera is un-rotatable. It's just staying looking down at the floor. |
|
|
| Report Abuse |
|
|
C0D3Y
|
  |
| Joined: 24 Jul 2010 |
| Total Posts: 1692 |
|
|
| 21 Jun 2012 01:16 PM |
Did you add the: WhateverYouNamedTheCamera.CameraType = "Custom"
If not, Idk, cameras much be buggy... Really hoping someone who's experienced in camera manipulation*cough* CM32 *cough* comes and helps. I'm not saying I only want CM32, anyone who can help I'd love to find out what I'm doing wrong so I can fix the darn thing... |
|
|
| Report Abuse |
|
|
smurf279
|
  |
| Joined: 15 Mar 2010 |
| Total Posts: 6871 |
|
|
| 21 Jun 2012 01:26 PM |
| Yeah I had the same problem but I just worked around by using the other arguments in CFrame.. I'll see if I can fix up your code for that brb |
|
|
| Report Abuse |
|
|
smurf279
|
  |
| Joined: 15 Mar 2010 |
| Total Posts: 6871 |
|
|
| 21 Jun 2012 01:28 PM |
| btw you're supposed to set the camera type to scriptable |
|
|
| Report Abuse |
|
|
C0D3Y
|
  |
| Joined: 24 Jul 2010 |
| Total Posts: 1692 |
|
|
| 21 Jun 2012 01:28 PM |
| Thank you very much :) All I'm trying to do is find a way to have the camera look in front of the part, I didn't think it was gonna be so complicated... |
|
|
| Report Abuse |
|
|
C0D3Y
|
  |
| Joined: 24 Jul 2010 |
| Total Posts: 1692 |
|
|
| 21 Jun 2012 01:29 PM |
| Late post, but yes I know to make the cameratype to scriptable. I was saying when you want to return to the player's "normal" camera, you would do custom. |
|
|
| Report Abuse |
|
|
|
| 21 Jun 2012 01:30 PM |
| My 2d-Camera wasnt working either. |
|
|
| Report Abuse |
|
|
|
| 21 Jun 2012 01:30 PM |
In local script:
local cam = Workspace.CurrentCamera local part = Workspace.Orbit local radius = 10
cam.CameraType = "Scriptable"
for i=0, 360, 5 do local a = math.sin(math.pi/180*i) * radius local b = math.cos(math.pi/180*i) * radius local c = Vector3.new(a, 0, b) cam.CoordinateFrame = CFrame.new(c, part.CFrame.p) cam.Focus = part.CFrame wait(0.1) end
cam.CameraType = "Custom" |
|
|
| Report Abuse |
|
|
C0D3Y
|
  |
| Joined: 24 Jul 2010 |
| Total Posts: 1692 |
|
|
| 21 Jun 2012 01:31 PM |
| Dude... What are you talking about? I haven't taken trig but I can guess that will just circle around the part and you copied it from the wiki. _Not what I need_. |
|
|
| Report Abuse |
|
|
|
| 21 Jun 2012 01:42 PM |
When using the Scriptable camera type, Focus is not used. Instead, it's sort of combined with CoordinateFrame.
Position at 0,0,0 and look at position 10,10,10:
Other camera types:
cam.CoordinateFrame = CFrame.new(0,0,0) cam.Focus = CFrame.new(10,10,10)
Scriptable camera type:
cam.CoordinateFrame = CFrame.new(Vector3.new(0,0,0), Vector3.new(10,10,10)) |
|
|
| Report Abuse |
|
|
smurf279
|
  |
| Joined: 15 Mar 2010 |
| Total Posts: 6871 |
|
|
| 21 Jun 2012 01:43 PM |
local cam = workspace.CurrentCamera cam.CameraType = "Scriptable" local _, _, _, _, _, _, r21, r22, r23, r31, r32, r33 = cam.CoordinateFrame:components() cam.CoordinateFrame = CFrame.new( worspace.Part.Position, Workspace.Part.Position-Vector3.new(0, 15, 0) , Vector3.new(r21, r22, r23), Vector3.new(r31, r32, r33) )
|
|
|
| Report Abuse |
|
|
smurf279
|
  |
| Joined: 15 Mar 2010 |
| Total Posts: 6871 |
|
|
| 21 Jun 2012 01:44 PM |
aghh
crazy was barely 1 minute ahead of me too >.< |
|
|
| Report Abuse |
|
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 21 Jun 2012 01:45 PM |
^
Except you just recreated the matrix for some reason. |
|
|
| Report Abuse |
|
|
smurf279
|
  |
| Joined: 15 Mar 2010 |
| Total Posts: 6871 |
|
|
| 21 Jun 2012 01:47 PM |
| to preserve the other rotation stuff. CFrame.new() resets everything so I wasn't sure if he wanted that |
|
|
| Report Abuse |
|
|
C0D3Y
|
  |
| Joined: 24 Jul 2010 |
| Total Posts: 1692 |
|
|
| 21 Jun 2012 01:47 PM |
@CM32
Well that's unfortunate... I guess I'll just have to CFrame the brick so it's facing forward...
@Smurf, I'll try it, if not I'll just CFrame it like I said before. |
|
|
| Report Abuse |
|
|
|
| 21 Jun 2012 01:48 PM |
| I suggest not using bricks to position the camera. You can just as easily do away with the bricks and use basic CFrame manipulation |
|
|
| Report Abuse |
|
|
MrNicNac
|
  |
| Joined: 29 Aug 2008 |
| Total Posts: 26567 |
|
|
| 21 Jun 2012 01:48 PM |
| Then just multiply the coordinate frames, or get the angles view toEulerAngles. Rebuilding a matrix after taking it apart is quite confusing, because it doesn't always end up right. Which I believe is due to the lack of quaternions. |
|
|
| Report Abuse |
|
|
C0D3Y
|
  |
| Joined: 24 Jul 2010 |
| Total Posts: 1692 |
|
|
| 21 Jun 2012 01:51 PM |
@MrNicNac, yeah, I never really understood the whole matrix thing so I'll try not to go into that
@CM32
I see where you're coming from, but I'm building a drone and I'd rather just continually set the camera's CFrame to the same as the "camera" of the drone and move the entire drone than using math to change it all around. |
|
|
| Report Abuse |
|
|
smurf279
|
  |
| Joined: 15 Mar 2010 |
| Total Posts: 6871 |
|
|
| 21 Jun 2012 01:53 PM |
"get the angles view toEulerAngles"
forgot about that lol. . . anyways i just went to test it out and got invlaid number of arguments.. isn't CFrame supposed to unpack the vectors? |
|
|
| Report Abuse |
|
|
smurf279
|
  |
| Joined: 15 Mar 2010 |
| Total Posts: 6871 |
|
|
| 21 Jun 2012 01:55 PM |
"I see where you're coming from, but I'm building a drone and I'd rather just continually set the camera's CFrame to the same as the "camera" of the drone and move the entire drone than using math to change it all around."
In this case set the drone as your camera subject the camera will move with the drone. you can reset it by setting the camera subject back to the players character later |
|
|
| Report Abuse |
|
|
C0D3Y
|
  |
| Joined: 24 Jul 2010 |
| Total Posts: 1692 |
|
|
| 21 Jun 2012 01:56 PM |
| Definitely would do that, but it's remote controlled and what I'm doing is making you pretty much see through the drone's camera, so you see what the drone would see. |
|
|
| Report Abuse |
|
|
Ubayla
|
  |
| Joined: 01 Dec 2008 |
| Total Posts: 157 |
|
|
| 21 Jun 2012 02:07 PM |
| You have the CoordinateFrame INSIDE the part, if you're inside a part looking out (as you were) you won't see it. Try switching the numbers and changing the CameraType to "Scriptable" |
|
|
| Report Abuse |
|
|
C0D3Y
|
  |
| Joined: 24 Jul 2010 |
| Total Posts: 1692 |
|
|
| 21 Jun 2012 02:10 PM |
| Did the last thing and was working on the other one. BTW, that was just an example. In the real version I added a vector3 to it so it would be outside of it. No offense to you but I'm not that new to scripting. |
|
|
| Report Abuse |
|
|
|
| 21 Jun 2012 02:12 PM |
| (Try fractions) eg. 1/100 or .01 |
|
|
| Report Abuse |
|
|