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 » Scripting Helpers
Home Search
 

Re: Rotating the camera

Previous Thread :: Next Thread 
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
30 Sep 2014 02:09 PM
So I am trying to make a way to rotate the camera with the keyboard (f, g, h, and t)


I want f to be left, g to be down, h to be right, and t to be up

But I can't figure out how to make the camera rotate left or right, because
Workspace.CurrentCamera.CoordinateFrame = Workspace.CurrentCamera.CoordinateFrame+Vector3.new(0, 0, 1)


Goes right and slightly down if you have your camera in front of your character
But it goes left and slightly down if you have your camera in behind you


How can I make it always go right, and not go down
Report Abuse
Badfitz100 is not online. Badfitz100
Joined: 03 Nov 2010
Total Posts: 12591
30 Sep 2014 02:12 PM
I used to have a script for this, but it's in the models of a deleted account. :(

Hibachi Man makes his daring escape, The Barbecue Belly Slide!
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
30 Sep 2014 02:16 PM
I basically need it to move like the left and right arrow keys move it but with f and h, but also up and down with the other 2 keys (t and g)


I can do the keys part but I don't know how to rotate the camera
Report Abuse
filiptibell is not online. filiptibell
Joined: 10 Mar 2013
Total Posts: 2362
30 Sep 2014 02:20 PM
Workspace.CurrentCamera.CoordinateFrame = Workspace.CurrentCamera.CoordinateFrame * CFrame.Angles(0, math.rad(1), 0) -- will rotate 1 degree to the side... probably.

Is this what you mean?

~The herp lerped a derp~
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
30 Sep 2014 02:21 PM
No that doesn't move the camera at all, thanks though
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
30 Sep 2014 04:11 PM
local target = workspace.Player.Head
local camera = workspace.CurrentCamera
for x = 1, 100 do
wait()
camera.CoordinateFrame = camera.CoordinateFrame * CFrame.new(1, 0, 0)
end


The only problem now is it still goes down slightly for no reason
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
30 Sep 2014 04:23 PM
This isn't my script its a edited version of one that was on the forums

local target = workspace.Player.Head
local camera = workspace.CurrentCamera
local angle = 0
while wait() do
camera.CoordinateFrame = CFrame.new(target.Position)
* CFrame.Angles(0,angle, 0)
* CFrame.new(0, 0, 30)
angle = angle + math.rad(1)
end


It works but I need to add to whatever angle the camera currently is not just set it to a value
Report Abuse
filiptibell is not online. filiptibell
Joined: 10 Mar 2013
Total Posts: 2362
30 Sep 2014 04:31 PM
Check if something like this works:

local camera = workspace.CurrentCamera
local angle = 0
while wait() do
camera.CoordinateFrame = CFrame.new(camera.CoordinateFrame.p)
* CFrame.Angles(0,angle, 0)
* CFrame.new(0, 0, 30)
angle = angle + math.rad(1)
end

~The herp lerped a derp~
Report Abuse
ByDefault is not online. ByDefault
Joined: 25 Jul 2014
Total Posts: 3197
30 Sep 2014 04:38 PM
When the player joins, spawn a brick and have the camera attached to it, then you move the part and the camera will follow it.
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
30 Sep 2014 05:02 PM
I fixed it, I used this

local player, camera = game.Players.LocalPlayer, workspace.CurrentCamera
local controller, bounce = player.controller, {}

local buttons = {
A = function()
player.Character.Humanoid.Jump = true
end;
S2D = function()
camera.CoordinateFrame = camera.CoordinateFrame * CFrame.new(0, -0.75, 0)
end;
S2L = function()
camera.CoordinateFrame = camera.CoordinateFrame * CFrame.new(-0.75, 0, 0)
end;
S2R = function()
camera.CoordinateFrame = camera.CoordinateFrame * CFrame.new(0.75, 0, 0)
end;
S2U = function()
camera.CoordinateFrame = camera.CoordinateFrame * CFrame.new(0, 0.75, 0)
end;
}

for _, b in pairs (controller:GetChildren()) do
if buttons[b.Name] then
b.Changed:connect(function()
if b.Value ~= 0 and not bounce[b.Name] then
bounce[b.Name] = true
repeat
pcall(function() buttons[b.Name]() end)
wait(0.03)
until b.Value == 0
bounce[b.Name] = false
end
end)
end
end
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
30 Sep 2014 05:14 PM
In case anyone was wondering / cares

Im making a xbox 360 controller work with roblox,
I have a bunch of number values (Named after the button they represent) inside the player

When a key is pressed the number values change (They count up at 10 per second) until the key is let go

Im using keytojoy to make the controller work like a keyboard

I was trying to make S2 (Stick 2) control the camera movement

There are 24 buttons (Not counting the homebutton) on a 360 controller and 26 letters on a keyboard
2 of those (i and o) are used by roblox already, and I didn't wanna use numbers / symbols and stuff
I got really lucky its just barely enough

Im gonna upload a video if someone wants to see
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
30 Sep 2014 05:30 PM
https://www.youtube.com/watch?v=ytZ2i4JGgWo&feature=youtu.be
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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