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 can I disable the camera moving when right clicking?

Previous Thread :: Next Thread 
Codys4x4 is not online. Codys4x4
Joined: 14 Oct 2006
Total Posts: 2312
27 Jan 2015 05:23 PM
Trying to make a 2D game and cant figure that out.
Report Abuse
Codys4x4 is not online. Codys4x4
Joined: 14 Oct 2006
Total Posts: 2312
27 Jan 2015 05:49 PM
Bump
Report Abuse
Codys4x4 is not online. Codys4x4
Joined: 14 Oct 2006
Total Posts: 2312
27 Jan 2015 05:56 PM
Bump
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
27 Jan 2015 05:57 PM
Use a Scriptable camera for everything involving camera manipulation.
Report Abuse
Codys4x4 is not online. Codys4x4
Joined: 14 Oct 2006
Total Posts: 2312
27 Jan 2015 06:01 PM
Can I set camera to scriptable then change the angle of it?
If I where to do that would it still follow the user around and stay in the same angle?
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
27 Jan 2015 06:02 PM
No, so you need to set it every frame with RenderStepped.
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
27 Jan 2015 06:06 PM
Here's a camera LocalScript:



local cam = workspace.CurrentCamera
local plr = game.Players.LocalPlayer
local Dist = 10 --How many studs away from char you want the camera to be
repeat c = plr.Character until c ~= nil
wait()
cam.CameraType = "Scriptable"

while wait() do
cam:Interpolate(CFrame.new(c.Head.Position+Vector3.new(0, 0, -Dist)), CFrame.new(c.Head.Position), .1)
end


Here's a movement LocalScript:



local plr = game.Players.LocalPlayer
repeat c = plr.Character until c ~= nil
wait()
torso = c.Torso
local bp = Instance.new("BodyPosition")
bp.Name = "TwoD" --Change this to whatever you wish to call the BodyPosition
bp.position = torso.Position
bp.P = 1000000
bp.D = 1000
bp.maxForce = Vector3.new(0, 0, 1000000) --If you want the player to move at a different Axis, replace a 0 with it, and then replace the original spot with a 0, example: (1000000, 0, 0)
bp.Parent = torso



Place them both in LocalScripts and 2D is solved.
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
27 Jan 2015 06:07 PM
They both go in StarterGui BTW
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
27 Jan 2015 06:09 PM
"while wait() do
cam:Interpolate(CFrame.new(c.Head.Position+Vector3.new(0, 0, -Dist)), CFrame.new(c.Head.Position), .1)
end"

I would just do

game:GetService("RunService").RenderStepped:connect(function()
cam.CoordinateFrame = CFrame.new(c.Head.Position+Vector3.new(0, 0, -Dist))
end)
Report Abuse
cody123454321 is not online. cody123454321
Joined: 21 Nov 2009
Total Posts: 5408
27 Jan 2015 06:13 PM
@Jarod
Do you mean
cam.CoordinateFrame = CFrame.new(c.Head.Position) * CFrame.new(0, 0, -Dist)
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
27 Jan 2015 06:14 PM
It's the same thing actually.
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
27 Jan 2015 06:20 PM
@Jarod Interpolate is actually better, due to the fact that you can make the camera "lag" behind a bit :P
Report Abuse
Codys4x4 is not online. Codys4x4
Joined: 14 Oct 2006
Total Posts: 2312
27 Jan 2015 08:36 PM
Well I jut needed to disable right click.
I have this so far, lol.
I'll work something out, Thanks.

local Plr = game.Players.LocalPlayer
repeat wait() until Plr.Character
local Mouse = Plr:GetMouse()
workspace:FindFirstChild(Plr.Name).Humanoid.WalkSpeed = 0
Plr.CameraMaxZoomDistance,Plr.CameraMinZoomDistance = 15,15

Mouse.KeyDown:connect(function(key)
if key == "d" or key == "a" then
workspace:FindFirstChild(Plr.Name).Humanoid.WalkSpeed = 16
else
workspace:FindFirstChild(Plr.Name).Humanoid.WalkSpeed = 0
end
end)
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
27 Jan 2015 08:37 PM
But the camera won't "Lag" behind when you are using it on the Character. That only happens on parts managed by the server.
Report Abuse
xolbStudios is not online. xolbStudios
Joined: 05 Nov 2009
Total Posts: 504
27 Jan 2015 08:46 PM
Interpolation is typically smoother.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
27 Jan 2015 08:48 PM
Jarod, it's not the same thing (referring to .CoordinateFrame = blah posts). What he said would work as one would expect, what you said would work if their rotation was "default" (0).
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
27 Jan 2015 08:48 PM
Well, no I'm wrong since I can't read.
You both did it wrong, but yes both of yours is the same thing.

camera.CoordinateFrame = head.CFrame * CFrame.new(0, 0, -dist) is the correct way to do it.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
27 Jan 2015 08:49 PM
That's not what I'm saying. If you are setting the camera's position based on just the character or only things dependent on the client, you can just use RenderStepped, because it is as smooth as you can get.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
27 Jan 2015 08:51 PM
"Trying to make a 2D game"
>Implies camera doesn't rotate

And if it is pointing in the wrong direction, he can just rotate the CFrame. But I am assuming he doesn't want it moving with the character.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
27 Jan 2015 08:52 PM
Ahh, well you see some people like myself only read the title and the replies...
I'm a dumb.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
27 Jan 2015 08:53 PM
I only read the title and parts of the post, maybe a few replies by favorite people (cntkillme, eLunate, 128GB)

It's really weird that way. :\
Report Abuse
xolbStudios is not online. xolbStudios
Joined: 05 Nov 2009
Total Posts: 504
27 Jan 2015 08:54 PM
local plr = game.Players.LocalPlayer
repeat wait() until plr.Character
local char = plr.Character
local hum = char:WaitForChild("Humanoid")
local bpos = Instance.new("BodyPosition")
local cam = game.Workspace.CurrentCamera
local m2d = false
bpos.maxForce = Vector3.new(math.huge,0,0)
bpos.position = Vector3.new(0,0,0)
cam.CameraType = "Scriptable"

plr:GetMouse().Button2Down:connect(
function()
m2d = true
end
)
plr:GetMouse().Button2Up:connect(
function()
m2d = false
end
)

game:GetService('RunService').Heartbeat:connect(
function()
if m2d then return false end
cam:Interpolate(CFrame.new(char.PrimaryPart.Position +Vector3.new(0,0,15)),char.PrimaryPart.CFrame,0.1)
end
)
Report Abuse
Codys4x4 is not online. Codys4x4
Joined: 14 Oct 2006
Total Posts: 2312
27 Jan 2015 08:55 PM
Let's say I do this, Is there a way to make the angle point at the player?

game:GetService("RunService").RenderStepped:connect(function()
Cam.CoordinateFrame = CFrame.new(workspace[Plr.Name].Head.Position) * CFrame.new(0, 0, -10) * CFrame.Angles(0, 0, 0)
end)

No matter what I put in CFrame.Angles it does not go where I need it to, It stays behind the user.
Report Abuse
Codys4x4 is not online. Codys4x4
Joined: 14 Oct 2006
Total Posts: 2312
27 Jan 2015 08:58 PM
Cam:Interpolate(CFrame.new(workspace[Plr.Name].Head.Position + Vector3.new(0,0,15)),workspace[Plr.Name].Head.CFrame,0.1)

Worked perfect, thanks. Can I also add an angle to this and make in somewhat looking down on the user?
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
27 Jan 2015 09:02 PM
You are supposed to rotate BEFORE you move the camera away -_-
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