digpoe
|
  |
| Joined: 02 Nov 2008 |
| Total Posts: 9092 |
|
|
| 10 Mar 2013 10:59 AM |
| How can I check if a player is zoomed in to the highest extent? If it's not possible, I'll need to make some changes to my code and then use LockFirstPerson camera mode. |
|
|
| Report Abuse |
|
|
|
| 10 Mar 2013 11:01 AM |
| Check the magnitude of the Camera's CoordinateFrame and the Player's Head. Get it to print the magnitude in output and zoom in fully to get the exact value. |
|
|
| Report Abuse |
|
|
jobro13
|
  |
| Joined: 05 Aug 2009 |
| Total Posts: 2865 |
|
|
| 10 Mar 2013 11:01 AM |
| Difference between head and camera.CoordinateFrame. Try it. |
|
|
| Report Abuse |
|
|
|
| 10 Mar 2013 11:03 AM |
(In a Local Script)
Cam = game.Workspace.CurrentCamera Plyr = game.Players.LocalPlayer
Dist = (Cam.CoordinateFrame.p - Player.Character.Head.Position).magnitude
|
|
|
| Report Abuse |
|
|
jobro13
|
  |
| Joined: 05 Aug 2009 |
| Total Posts: 2865 |
|
|
| 10 Mar 2013 11:04 AM |
| Zoomed in should - theoretically - be zero. |
|
|
| Report Abuse |
|
|
|
| 10 Mar 2013 11:07 AM |
| I've never tried it myself, so I just wanted to be sure. |
|
|
| Report Abuse |
|
|
Garnished
|
  |
| Joined: 09 Apr 2012 |
| Total Posts: 12695 |
|
|
| 10 Mar 2013 11:09 AM |
| There's a script called IsFirstPerson, it's by popinman. |
|
|
| Report Abuse |
|
|
|
| 10 Mar 2013 11:10 AM |
This is it: http://www.roblox.com/IsFirstPerson-item?id=93338294 |
|
|
| Report Abuse |
|
|
digpoe
|
  |
| Joined: 02 Nov 2008 |
| Total Posts: 9092 |
|
|
| 10 Mar 2013 11:11 AM |
Apparently it doesn't work when zooming in.. Would this be right:
wait() local cam = workspace.CurrentCamera local head = game.Players.LocalPlayer.Character.Head cam.Changed:connect(function() print((cam.CoordinateFrame.p - head.Position).magnitude) end)
It only seems to do it when I actually move the camera using right click or when zoomed in, moving the mouse. |
|
|
| Report Abuse |
|
|
jobro13
|
  |
| Joined: 05 Aug 2009 |
| Total Posts: 2865 |
|
|
| 10 Mar 2013 11:17 AM |
| Connecting a changed event of the camera? Not a good idea, every time you move that event will be called. Just call it every frame. |
|
|
| Report Abuse |
|
|
digpoe
|
  |
| Joined: 02 Nov 2008 |
| Total Posts: 9092 |
|
|
| 10 Mar 2013 11:20 AM |
| jobro, if I check it every frame, wouldn't it be the same as checking when the camera moves, as if the player is walking, the CoordinateFrame of the camera would change every frame, right? |
|
|
| Report Abuse |
|
|
jobro13
|
  |
| Joined: 05 Aug 2009 |
| Total Posts: 2865 |
|
|
| 10 Mar 2013 11:22 AM |
| Try it, I think studio crashes due the ammount of changed events being fired. I may be wrong tough. |
|
|
| Report Abuse |
|
|
digpoe
|
  |
| Joined: 02 Nov 2008 |
| Total Posts: 9092 |
|
|
| 10 Mar 2013 11:24 AM |
| I tried it in studio, and I don't crash. |
|
|
| Report Abuse |
|
|
jobro13
|
  |
| Joined: 05 Aug 2009 |
| Total Posts: 2865 |
|
|
| 10 Mar 2013 11:25 AM |
Strange, I still would not use it tough.
Same with the Touched event, runs too much and will lag you up. Unless you made a debounce. |
|
|
| Report Abuse |
|
|
digpoe
|
  |
| Joined: 02 Nov 2008 |
| Total Posts: 9092 |
|
|
| 10 Mar 2013 11:27 AM |
| Okay, I get similar values using both, but using the :Changed() event just seems better to me. It's about the 0.4 - 0.5 range for magnitude. |
|
|
| Report Abuse |
|
|
digpoe
|
  |
| Joined: 02 Nov 2008 |
| Total Posts: 9092 |
|
|
| 10 Mar 2013 11:31 AM |
| Okay, apparently I'm always zoomed in now. |
|
|
| Report Abuse |
|
|
digpoe
|
  |
| Joined: 02 Nov 2008 |
| Total Posts: 9092 |
|
|
| 10 Mar 2013 11:33 AM |
| Fixed that. It's helpful to remember what logic means. |
|
|
| Report Abuse |
|
|