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: Help with camera over should script.

Previous Thread :: Next Thread 
Eauz is not online. Eauz
Joined: 23 Jul 2013
Total Posts: 2942
31 Oct 2015 03:01 PM
I have made me own camera over shoulder script.. you can try it for yourself.. but I got a script under a bool value which activates the function in the script. I'm having one issue.

Torso Rotation (Torso rotates towards the mouse) is too flowy, if the mouse isn't in the middle, the torso keeps rotating towards the mouse offset off of the middle.. You can try it for yourself if you don't understand what I mean:

____________________________________

local player = game.Players.LocalPlayer
local char
while true do
pcall(function()
char = player.Character
end)
wait(0.25)
if char then break end
end
local head = char:WaitForChild("Head")
local torso = char:WaitForChild("Torso")
local humanoid = char:WaitForChild("Humanoid")
local cam = game.Workspace.CurrentCamera
local mouse = player:GetMouse()
local activate = script.Parent

rs = game:GetService("RunService")
uis = game:GetService("UserInputService")

--checkers
active = false


local bg = Instance.new("BodyGyro")
bg.maxTorque = Vector3.new(0,0,0)
bg.Parent = torso


activate.Changed:connect(function()
if activate.Value == true then
active = true
cam.CameraType = 'Scriptable'
bg.cframe = mouse.Hit
bg.maxTorque = Vector3.new(0,math.huge,0)
humanoid.AutoRotate = false
repeat
bg.cframe = mouse.hit
cam.CoordinateFrame = head.CFrame:toWorldSpace(CFrame.new(3,0.8,4))
rs.RenderStepped:wait()
until active == false

elseif activate.Value == false then
wait(0.25)
active = false
cam.CameraType = 'Custom'
bg.maxTorque = Vector3.new(0,0,0)
humanoid.AutoRotate = true
end
end)

__________________________________________________________

Can you help? Thanks! (OH BTW.. It's a localscript that is suppose to go under a bool value under StarterPack)

http://www.roblox.com/Eauz-1080p-item?id=291584308
Report Abuse
Zecrit is not online. Zecrit
Joined: 24 Jan 2013
Total Posts: 2618
31 Oct 2015 03:05 PM
Try making an invisible frame or something follow the mouse over the screen but with a delay of about 0.1 seconds and use absoluteposition of the frame to read when the mouse has moved to either the left or the right of it. That should theoretically emulate MouseLock.
Report Abuse
Eauz is not online. Eauz
Joined: 23 Jul 2013
Total Posts: 2942
31 Oct 2015 03:10 PM
I am sorry but I don't seem to understand what you mean.

http://www.roblox.com/Eauz-1080p-item?id=291584308
Report Abuse
Zecrit is not online. Zecrit
Joined: 24 Jan 2013
Total Posts: 2618
31 Oct 2015 03:16 PM
Say you have a Frame.

That frame has its own little bit of code which makes it follow the mouse around the screen by reading the mouse's position and moving itself there 0.1 seconds after reading.

This means that if you use absoluteposition+absolutesize you can find the arbitrary borders of the frame and use an if statements to scan for whenever the mouse's X position goes < the frame's left border or > its right border. Which then makes the torso rotate in the given left or right direction.

This means that if the mouse isn't moving on the screen then the torso wont rotate regardless of the mouse's position and should be akin to how Mouse Lock works.
Report Abuse
Eauz is not online. Eauz
Joined: 23 Jul 2013
Total Posts: 2942
31 Oct 2015 03:38 PM
Thanks for the suggestion but I do think there are easier ways of doing this.

http://www.roblox.com/Eauz-1080p-item?id=291584308
Report Abuse
Zecrit is not online. Zecrit
Joined: 24 Jan 2013
Total Posts: 2618
31 Oct 2015 03:41 PM
I really don't think there are.

Unless you want to rotate the torso degrees by the X number of pixels the mouse moved across the screen instead?
I think that would be more difficult actually.
Report Abuse
Eauz is not online. Eauz
Joined: 23 Jul 2013
Total Posts: 2942
01 Nov 2015 11:27 AM
BUMP. I still don't understand. A day has passed trying to understand hwta you write but okay.

http://www.roblox.com/Eauz-1080p-item?id=291584308
Report Abuse
Eauz is not online. Eauz
Joined: 23 Jul 2013
Total Posts: 2942
01 Nov 2015 11:55 AM
Bump2

http://www.roblox.com/Eauz-1080p-item?id=291584308
Report Abuse
Eauz is not online. Eauz
Joined: 23 Jul 2013
Total Posts: 2942
01 Nov 2015 01:20 PM
Bump3

http://www.roblox.com/Eauz-1080p-item?id=291584308
Report Abuse
Eauz is not online. Eauz
Joined: 23 Jul 2013
Total Posts: 2942
01 Nov 2015 01:39 PM
Bump4

http://www.roblox.com/Eauz-1080p-item?id=291584308
Report Abuse
HRnSN is not online. HRnSN
Joined: 22 Jun 2009
Total Posts: 1276
01 Nov 2015 02:17 PM
Humanoid.CameraOffset?
Report Abuse
Eauz is not online. Eauz
Joined: 23 Jul 2013
Total Posts: 2942
01 Nov 2015 02:17 PM
20 days later....... Bump521

http://www.roblox.com/Eauz-1080p-item?id=291584308
Report Abuse
Eauz is not online. Eauz
Joined: 23 Jul 2013
Total Posts: 2942
01 Nov 2015 02:18 PM
@HRnSN

I'll look into it :)

http://www.roblox.com/Eauz-1080p-item?id=291584308
Report Abuse
Eauz is not online. Eauz
Joined: 23 Jul 2013
Total Posts: 2942
01 Nov 2015 02:18 PM
Wait.. CameraOffset is irrelevant.

http://www.roblox.com/Eauz-1080p-item?id=291584308
Report Abuse
HRnSN is not online. HRnSN
Joined: 22 Jun 2009
Total Posts: 1276
01 Nov 2015 02:21 PM
Oooh didn't read the question lol.
Report Abuse
Eauz is not online. Eauz
Joined: 23 Jul 2013
Total Posts: 2942
01 Nov 2015 02:44 PM
Bump 522
Help me CrazyMan32 ):

http://www.roblox.com/Eauz-1080p-item?id=291584308
Report Abuse
Eauz is not online. Eauz
Joined: 23 Jul 2013
Total Posts: 2942
01 Nov 2015 04:16 PM
Bump523

http://www.roblox.com/Eauz-1080p-item?id=291584308
Report Abuse
Eauz is not online. Eauz
Joined: 23 Jul 2013
Total Posts: 2942
01 Nov 2015 04:37 PM
Bump524

http://www.roblox.com/Eauz-1080p-item?id=291584308
Report Abuse
Eauz is not online. Eauz
Joined: 23 Jul 2013
Total Posts: 2942
01 Nov 2015 05:37 PM
Bump525

http://www.roblox.com/Eauz-1080p-item?id=291584308
Report Abuse
Eauz is not online. Eauz
Joined: 23 Jul 2013
Total Posts: 2942
02 Nov 2015 08:58 AM
BUMP526

http://www.roblox.com/Eauz-1080p-item?id=291584308
Report Abuse
LeitrisArcade is online. LeitrisArcade
Joined: 15 May 2010
Total Posts: 2127
02 Nov 2015 09:03 AM
Use a BodyGyro in the character's humanoidrootpart and rotate its cframe based on the mouse's delta movement. You'll also have to lock the mouse in the center of the screen to do this.

http://wiki.roblox.com/index.php?title=API:Class/UserInputService/MouseBehavior


FilteringDisabled is for squares
Report Abuse
Eauz is not online. Eauz
Joined: 23 Jul 2013
Total Posts: 2942
02 Nov 2015 09:32 AM
Thank you very much. I think I can work with that, I have changed my script now.. But.. Nothing happens, no errors, no prints, no nothing. May you please check it out for me?

_________________________________________________

local player = game.Players.LocalPlayer
local char
while true do
pcall(function()
char = player.Character
end)
wait(0.25)
if char then break end
end
local head = char:WaitForChild("Head")
local torso = char:WaitForChild("Torso")
local humanoid = char:WaitForChild("Humanoid")
local cam = game.Workspace.CurrentCamera
local mouse = player:GetMouse()
local activate = script.Parent

rs = game:GetService("RunService")
uis = game:GetService("UserInputService")

--checkers
active = false

local bg = Instance.new("BodyGyro")
bg.maxTorque = Vector3.new(0,0,0)
bg.Parent = torso


activate.Changed:connect(function()
if activate.Value == true then
active = true
cam.CameraType = 'Scriptable'
humanoid.AutoRotate = false
bg.cframe = mouse.Hit
bg.maxTorque = Vector3.new(0,math.huge,0)
uis.MouseBehavior = "LockCenter"
uis.InputChanged:connect(function(Object)
if Object == Enum.UserInputType.MouseMovement then
cam.CoordinateFrame = head.CFrame:toWorldSpace(CFrame.new(3,0.8,4))
bg.cframe = CFrame.new(Object.Delta.X,Object.Delta.Y,0)
end
end)

elseif activate.Value == false then
wait(0.25)
active = false
cam.CameraType = 'Custom'
humanoid.AutoRotate = true
bg.maxTorque = Vector3.new(0,0,0)
uis.MouseBehavior = "Default"
end
end)

____________________________________________________________

http://www.roblox.com/Eauz-1080p-item?id=291584308
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