kingmatt2
|
  |
| Joined: 20 Aug 2011 |
| Total Posts: 6494 |
|
|
| 20 Aug 2013 11:01 AM |
| How can I assess the current camera from someone, in a regular script? |
|
|
| Report Abuse |
|
|
Newtrat
|
  |
| Joined: 13 Jun 2011 |
| Total Posts: 196 |
|
|
| 20 Aug 2013 11:02 AM |
From the wiki: "Camera objects exist only upon the viewer's client, residing in that user's local Workspace, and therefore cannot be edited directly from the server. As of the most recent versions of the game, the only way to access a client's Camera object is through a LocalScript running on that client."
So as far as I know, you can't. |
|
|
| Report Abuse |
|
|
Soquick
|
  |
| Joined: 01 Nov 2012 |
| Total Posts: 1497 |
|
|
| 20 Aug 2013 11:03 AM |
| Very Simple ... You don't. Unless you use _G. |
|
|
| Report Abuse |
|
|
kingmatt2
|
  |
| Joined: 20 Aug 2011 |
| Total Posts: 6494 |
|
|
| 20 Aug 2013 11:04 AM |
| How can I assess the current camera if the local script is in workspace? |
|
|
| Report Abuse |
|
|
Newtrat
|
  |
| Joined: 13 Jun 2011 |
| Total Posts: 196 |
|
|
| 20 Aug 2013 11:05 AM |
Soquick, I don't know that _G would work, either, since clients see a different version of _G from what the server sees. So, if you store the camera in _G in a client, the server still won't be able to access it.
I was thinking you might be able to pass a reference to the local camera by putting it in an ObjectValue, but I'm not sure whether attempting to reference that object on the server would actually work. It sounds like the camera object only exists on the client |
|
|
| Report Abuse |
|
|
|
| 20 Aug 2013 11:05 AM |
| A localscript can't run in the workspace unless it is under a character model (that is a character from a player) |
|
|
| Report Abuse |
|
|
Newtrat
|
  |
| Joined: 13 Jun 2011 |
| Total Posts: 196 |
|
|
| 20 Aug 2013 11:06 AM |
| If it's a local script in workspace (or anywhere else), then you can just use Workspace.CurrentCamera. |
|
|
| Report Abuse |
|
|
Newtrat
|
  |
| Joined: 13 Jun 2011 |
| Total Posts: 196 |
|
|
| 20 Aug 2013 11:07 AM |
| Ah, yeah, good point. OK, a local script running anywhere can use Workspace.CurrentCamera, but there are only a few places LocalScripts can actually run, and I'm pretty sure they're listed on the wiki page for LocalScripts. |
|
|
| Report Abuse |
|
|
kingmatt2
|
  |
| Joined: 20 Aug 2011 |
| Total Posts: 6494 |
|
|
| 20 Aug 2013 11:09 AM |
If I put Workspace.CurrentCamera:Destroy() Would that remove all the cameras? Or..? Im confuesd.... |
|
|
| Report Abuse |
|
|
Newtrat
|
  |
| Joined: 13 Jun 2011 |
| Total Posts: 196 |
|
|
| 20 Aug 2013 11:21 AM |
I'm not actually sure what would happen if you tried to destroy the camera. I assume it would be immediately replaced by another camera, if it worked at all.
But in any event this would only work on the camera for the player whose client this code is running on. |
|
|
| Report Abuse |
|
|
Soquick
|
  |
| Joined: 01 Nov 2012 |
| Total Posts: 1497 |
|
|
| 20 Aug 2013 11:31 PM |
| Removing the camera will change camera pos to 0,0,0 I think but reseting fixes it |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 20 Aug 2013 11:35 PM |
| Newtrat said it: store the camera in an object valuw |
|
|
| Report Abuse |
|
|