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: Camera Zoom

Previous Thread :: Next Thread 
Gojira34 is not online. Gojira34
Joined: 28 Dec 2009
Total Posts: 1040
28 Oct 2011 10:04 PM
How do I check how far a Player's camera is zoomed out?
Report Abuse
aboy5643a is not online. aboy5643a
Joined: 20 Nov 2010
Total Posts: 2785
28 Oct 2011 10:06 PM
mag = (LocalPlayer.Character.Head.Position - workspace.CurrentCamera.CoordinateFrame).magnitude.

returns the distance from head to camera.
Report Abuse
Gojira34 is not online. Gojira34
Joined: 28 Dec 2009
Total Posts: 1040
28 Oct 2011 10:07 PM
Ah, thanks.
Report Abuse
Gojira34 is not online. Gojira34
Joined: 28 Dec 2009
Total Posts: 1040
28 Oct 2011 10:11 PM
I can't get this to work. Can you see any errors?

wait(1)
local camera = game.Workspace.CurrentCamera
local amount = game.Players.LocalPlayer:findFirstChild("Zoom")
while wait(.5) do
local mag = (game.Players.LocalPlayer.Character.Head.Position - camera.CoordinateFrame).magnitude
if mag > amount.Value then
script.Parent.Block.Visible = true
else
script.Praent.Block.Visible = false
end
end

Output:
Fri Oct 28 21:09:53 2011 - Players.Player.PlayerGui.CameraLock.Restrict:5: bad argument #2 to '?' (Vector3 expected, got userdata)
Fri Oct 28 21:09:53 2011 - Script "Players.Player.PlayerGui.CameraLock.Restrict", Line 5
Fri Oct 28 21:09:53 2011 - stack end
Report Abuse
Gojira34 is not online. Gojira34
Joined: 28 Dec 2009
Total Posts: 1040
28 Oct 2011 10:11 PM
(Aside from the typo on line 9 lol)
Report Abuse
aboy5643a is not online. aboy5643a
Joined: 20 Nov 2010
Total Posts: 2785
28 Oct 2011 10:13 PM
CoordinateFrame.p

CoordinateFrame is a CFrame value... And doesn't apply to magnitude so use the p property of CFrame (position)
Report Abuse
Gojira34 is not online. Gojira34
Joined: 28 Dec 2009
Total Posts: 1040
28 Oct 2011 10:17 PM
Okay, its working now. Thanks!
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