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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
|
| 06 Jan 2015 04:39 PM |
bump
math geniuses, come to me pls |
|
|
| Report Abuse |
|
|
Fedorakid
|
  |
| Joined: 17 Jul 2010 |
| Total Posts: 7079 |
|
| |
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 07 Jan 2015 09:39 AM |
| camera.CoordinateFrame.lookVector.Y, right? |
|
|
| Report Abuse |
|
|
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 |
|
|