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 » Scripters
Home Search
 

Re: how do i detect this (camera stuff)

Previous Thread :: Next Thread 
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
06 Jan 2015 02:29 PM
lets say the perosn was in FPS mode

im trying to get a number to increase the more the camera is looking up, and the number decreases the more camera looks down.

camera.CoordinateFrame.lookVector numbers makes no sense so i have no idea how to use that whatsoever.
Report Abuse
LucasLua is not online. LucasLua
Joined: 18 Jun 2008
Total Posts: 7386
06 Jan 2015 02:39 PM
What you want is the difference between the 'looking-forward' angle and the current angle of the camera. Use the dot product of the 'looking-forward' lookVector and the current camera lookVector.

By "looking-forward" I mean the lookVector of a CFrame that is the player looking straight forward, instead of up or down.
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
06 Jan 2015 02:48 PM
Yes I know, but I don't know which numbers to fetch in the lookvector of the camera.

XYZ

not X.

all I know

ok
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
06 Jan 2015 02:51 PM
dude :Dot on wiki

Returns the scalar dot product of the two vectors

what is a scalar
Report Abuse
LucasLua is not online. LucasLua
Joined: 18 Jun 2008
Total Posts: 7386
06 Jan 2015 02:52 PM
local num = 0;
local stop = false;

while not stop and wait() do
local lookingforward = Character.Head.CFrame.lookVector;
local cameraAngle = CFrame.new(camera.CoordinateFrame.p, camera.Focus.p).lookVector
num = lookingforward:Dot(cameraAngle);
end
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
06 Jan 2015 02:59 PM
and again what does :Dot do/scalar mean, and why the head's lookvector?
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
06 Jan 2015 03:17 PM
while wait() do
local lookingforward = workspace.Player.Head.CFrame.lookVector
local cameraAngle = CFrame.new(workspace.CurrentCamera.CoordinateFrame.p, workspace.CurrentCamera.Focus.p).lookVector
num = lookingforward:Dot(cameraAngle)
print(num)
end

I get interesting result

At 0.1 (and a lot of decimals)

My camera point directly up or down, and I can't do something with each of up or down because I get the same number with up and down...

On the number 1 it's in the middle.
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
06 Jan 2015 04:02 PM
local lookingforward = workspace.Player.Head.CFrame.lookVector
local cameraAngle = CFrame.new(workspace.CurrentCamera.CoordinateFrame.p, workspace.CurrentCamera.Focus.p).lookVector
num = lookingforward:Dot(cameraAngle)
print(num)

so, middle of the screen it prints 1

when I begin to look down it slowly goes down and down until 0.1 minimum

And when i begin to look up it goes down until 0.1 minimum

I can't recognize if he looked up or down now, how to fix that?
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
06 Jan 2015 04:39 PM
bump

math geniuses, come to me pls
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
07 Jan 2015 09:37 AM
bump
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
07 Jan 2015 09:39 AM
camera.CoordinateFrame.lookVector.Y, right?
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
07 Jan 2015 09:47 AM
e.e

while wait() do print(workspace.CurrentCamera.CoordinateFrame.lookVector.Y) end

got me the results I needed, k thanks eLunate xD
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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