generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Checking if the player is zoomed in?

Previous Thread :: Next Thread 
digpoe is not online. 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
qwerty1806 is not online. qwerty1806
Joined: 20 Sep 2008
Total Posts: 737
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 is not online. jobro13
Joined: 05 Aug 2009
Total Posts: 2865
10 Mar 2013 11:01 AM
Difference between head and camera.CoordinateFrame. Try it.
Report Abuse
qwerty1806 is not online. qwerty1806
Joined: 20 Sep 2008
Total Posts: 737
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 is not online. jobro13
Joined: 05 Aug 2009
Total Posts: 2865
10 Mar 2013 11:04 AM
Zoomed in should - theoretically - be zero.
Report Abuse
qwerty1806 is not online. qwerty1806
Joined: 20 Sep 2008
Total Posts: 737
10 Mar 2013 11:07 AM
I've never tried it myself, so I just wanted to be sure.
Report Abuse
Garnished is not online. 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
qwerty1806 is not online. qwerty1806
Joined: 20 Sep 2008
Total Posts: 737
10 Mar 2013 11:10 AM
This is it:
http://www.roblox.com/IsFirstPerson-item?id=93338294
Report Abuse
digpoe is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image