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: Is there a way to simulate mouse-lock

Previous Thread :: Next Thread 
TheNewChicken is not online. TheNewChicken
Joined: 18 Mar 2015
Total Posts: 1997
25 May 2015 05:12 PM
Like when moveing anyway there character still faces forward?
Report Abuse
nQqzRYVpIKA5jLP is not online. nQqzRYVpIKA5jLP
Joined: 05 Mar 2015
Total Posts: 4135
25 May 2015 05:13 PM
Yes.
Report Abuse
amanda is not online. amanda
Joined: 21 Nov 2006
Total Posts: 5925
25 May 2015 05:14 PM
cframe the torso every time you move to where your mouse is pointing

before that make sure mouse is locked to center of screen.
Report Abuse
TheNewChicken is not online. TheNewChicken
Joined: 18 Mar 2015
Total Posts: 1997
25 May 2015 05:22 PM
On a side note is their a way to force the cameras zoom distance? I know how to set min and maxz but not force it. FOV is not what im looking for,
Report Abuse
bosswalrus is not online. bosswalrus
Joined: 04 Jan 2013
Total Posts: 5430
25 May 2015 05:23 PM
LocalScript in StarterGui

local player = game.Players.LocalPlayer
local char = player.CharacterAdded:wait()
local hrp = char:WaitForChild("HumanoidRootPart")
local cam = game.Workspace.CurrentCamera
print("Ready")
cam.CameraType = Enum.CameraType.Scriptable
game:GetService("UserInputService").MouseBehavior = Enum.MouseBehavior.LockCenter

local x = 0
local y = 0

spawn(function()
while true do
game:GetService("RunService").RenderStepped:wait()
hrp.CFrame = CFrame.new(hrp.Position) * CFrame.Angles(0, x, 0)
cam.CoordinateFrame = hrp.CFrame * CFrame.Angles(y, 0, 0) * CFrame.new(1, 2, 10)
end
end)

function MouseMove(name, state, inputObject)
x = x + (-inputObject.Delta.x / 100)
y = y + (-inputObject.Delta.y / 100)
if y > 1.5 then
y = 1.5
elseif y < -1.5 then
y = -1.5
end
end

game:GetService("ContextActionService"):BindActionToInputTypes("MouseMove", MouseMove, false, Enum.UserInputType.MouseMovement)

Off an open source place that I forget,

"I like to program." - Bosswalrus
Report Abuse
amanda is not online. amanda
Joined: 21 Nov 2006
Total Posts: 5925
25 May 2015 05:23 PM
set the max and min to the same number
Report Abuse
TheNewChicken is not online. TheNewChicken
Joined: 18 Mar 2015
Total Posts: 1997
25 May 2015 05:24 PM
Uh not a script that complex.

I just want to make them go out of Firstperson and back in with the toggling key x.

I have all the UIS setup, i just need to toggle it.
Report Abuse
TheNewChicken is not online. TheNewChicken
Joined: 18 Mar 2015
Total Posts: 1997
25 May 2015 05:26 PM
@amanda

Oh wow how do i not realize.
Report Abuse
Leveraged is not online. Leveraged
Joined: 23 Jul 2010
Total Posts: 11564
25 May 2015 05:38 PM
You know there's a minzoomdistance and maxzoom in starterplayer...



Leveraged/tixmaker101 + 55k posts |
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