drahsid5
|
  |
| Joined: 13 May 2011 |
| Total Posts: 3937 |
|
|
| 17 Mar 2015 05:44 PM |
Is there a way I can do this? I'm trying to make a third person camera, I was thinking if I got the screen resolution and divided the X and Y by 180 I could make it work. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|
drahsid5
|
  |
| Joined: 13 May 2011 |
| Total Posts: 3937 |
|
|
| 17 Mar 2015 05:46 PM |
| That returns Vector2.new(0,0) >.> |
|
|
| Report Abuse |
|
|
drahsid5
|
  |
| Joined: 13 May 2011 |
| Total Posts: 3937 |
|
|
| 17 Mar 2015 05:48 PM |
| I just noticed, I'd be locking the mouse, I need to get the speed in which the mouse is moving. o3o |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 17 Mar 2015 05:48 PM |
| Are you using a local script? How do you expect the server to know the size of a client's screen c: |
|
|
| Report Abuse |
|
|
WebGL3D
|
  |
| Joined: 04 Sep 2013 |
| Total Posts: 28311 |
|
|
| 17 Mar 2015 05:48 PM |
@drah it will return the screen resolution, but only for LocalScript, as it is a client-sided property.
~ 1Topcop ~ WebGL3D ~ Java3D ~ Data3D ~ Purple Squid > |
|
|
| Report Abuse |
|
|
drahsid5
|
  |
| Joined: 13 May 2011 |
| Total Posts: 3937 |
|
|
| 17 Mar 2015 05:50 PM |
I normal use local scripts. o3o
Btw in a local script:
g = Instance.new("ScreenGui") print(g.AbsoluteSize)
>(0,0) |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 17 Mar 2015 05:51 PM |
| You need to actually parent it, and if it still doesn't work add a wait() or something. |
|
|
| Report Abuse |
|
|
drahsid5
|
  |
| Joined: 13 May 2011 |
| Total Posts: 3937 |
|
|
| 17 Mar 2015 05:52 PM |
Yeah, I just noticed that. :p Anyways, I don't even need it, As I noticed I need to get the speed in which the mouse is moving rather than the position of the mouse. |
|
|
| Report Abuse |
|
|
drahsid5
|
  |
| Joined: 13 May 2011 |
| Total Posts: 3937 |
|
|
| 17 Mar 2015 05:56 PM |
| The wiki has nothing on getting the speed in which the mouse is moving. o3o |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 17 Mar 2015 05:56 PM |
| well store the position of the mouse coords, wait x seconds and get the current position. v = displacement/time waited |
|
|
| Report Abuse |
|
|
drahsid5
|
  |
| Joined: 13 May 2011 |
| Total Posts: 3937 |
|
|
| 17 Mar 2015 05:58 PM |
But The mouse will be locked. It's coords will always be (0,0) |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 17 Mar 2015 05:58 PM |
| Well check for the camera since that moves :) |
|
|
| Report Abuse |
|
|
|
| 17 Mar 2015 05:59 PM |
| you take the mouse maxscreen whatever and then you ahve to divide the delta by that or do something else or big screens = slow af |
|
|
| Report Abuse |
|
|
drahsid5
|
  |
| Joined: 13 May 2011 |
| Total Posts: 3937 |
|
|
| 17 Mar 2015 06:00 PM |
What? You mean like Mouse.Move:connect(function() --Something to do with the camera? end) |
|
|
| Report Abuse |
|
|
drahsid5
|
  |
| Joined: 13 May 2011 |
| Total Posts: 3937 |
|
|
| 17 Mar 2015 06:03 PM |
I currently have local g = Instance.new("ScreenGui",game.Players.LocalPlayer) local Size = g.AbsoluteSize g:Destroy() while wait(1/60) do local mPos = Vector2.new(mouse.X,mouse.Y) --print(mPos) cam.CoordinateFrame = Player.Core.CFrame*CFrame.new(0,3,12)*CFrame.fromEulerAnglesXYZ(Size.Y-mPos.Y/180,Size.X-mPos.X/180,0) end
but This has nothing to do with the mouse movement speed. |
|
|
| Report Abuse |
|
|
kert109
|
  |
| Joined: 31 Dec 2009 |
| Total Posts: 681 |
|
|
| 17 Mar 2015 06:20 PM |
Didn't read anything in between the post.
Roblox will be coming out with lots of functions for the camera, one letting you get the screen size.
I don't want to say much yet, but that's one of them.
For now, you can use Mouse.X and Mouse.Y for the screen size. |
|
|
| Report Abuse |
|
|
drahsid5
|
  |
| Joined: 13 May 2011 |
| Total Posts: 3937 |
|
|
| 17 Mar 2015 06:23 PM |
I don't need the screen size though, I need the mouse speed. o3o
|
|
|
| Report Abuse |
|
|
kert109
|
  |
| Joined: 31 Dec 2009 |
| Total Posts: 681 |
|
|
| 17 Mar 2015 06:25 PM |
From the wiki:
Game:GetService("UserInputService").MouseBehavior = Enum.MouseBehavior.LockCenter Game:GetService("UserInputService").InputChanged:connect(function(inputObject) if inputObject.UserInputType == Enum.UserInputType.MouseMovement then print("delta is (" .. tostring(inputObject.Delta.x) .. ", " .. tostring(inputObject.Delta.y) .. ")") end end)
Delta is what your looking for. |
|
|
| Report Abuse |
|
|
drahsid5
|
  |
| Joined: 13 May 2011 |
| Total Posts: 3937 |
|
|
| 17 Mar 2015 06:33 PM |
Thanks.
while wait(1/60) do game:GetService("UserInputService").InputChanged:connect(function(inputObject) cam.CoordinateFrame = Player.Core.CFrame*CFrame.new(0,5,-3) cam.CoordinateFrame = cam.CoordinateFrame*CFrame.fromEulerAnglesXYZ(inputObject.Delta.x/10,inputObject.Delta.y/10,0) end) end
It's buggy, but I'll figure it out. |
|
|
| Report Abuse |
|
|
drahsid5
|
  |
| Joined: 13 May 2011 |
| Total Posts: 3937 |
|
|
| 17 Mar 2015 06:59 PM |
I can't seem to get it to stay at the angle it returns to (0,0) (Even though I add it too the lookVector?)
while wait(1/60) do game:GetService("UserInputService").InputChanged:connect(function(inputObject) cam.CoordinateFrame = (Player.Core.CFrame+Vector3.new(0,4,3))*(CFrame.fromEulerAnglesXYZ(inputObject.Delta.y/10,inputObject.Delta.x/10*-1,0)+cam.CoordinateFrame.lookVector) print("delta is (" .. tostring(inputObject.Delta.x) .. ", " .. tostring(inputObject.Delta.y) .. ")") end) end |
|
|
| Report Abuse |
|
|