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: Rotate the players camera upwards

Previous Thread :: Next Thread 
EmsyThorne is not online. EmsyThorne
Joined: 07 May 2015
Total Posts: 183
10 Aug 2015 04:09 PM
Hey everyone,

So I added in an introduction where the camera circles the map around a block. However, I want the camera to look down on the map, by being on a 45 degree angle. How would I add this to the following script?

local target = workspace.Part
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.CameraSubject = target
local angle = 0

while wait() do
camera.CoordinateFrame = CFrame.new(target.Position)
* CFrame.Angles(0, angle, 0)
* CFrame.new(0, 20, 20)
angle = angle + math.rad(0.5)

end
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
10 Aug 2015 04:11 PM
"Rotate the players camera upwards"
"I want the camera to look down on the map"

which one
Report Abuse
EmsyThorne is not online. EmsyThorne
Joined: 07 May 2015
Total Posts: 183
10 Aug 2015 04:13 PM
Sorry for my wording in the title.

Look down upon the map
Report Abuse
LegitimatlyMe is not online. LegitimatlyMe
Joined: 30 Oct 2013
Total Posts: 1108
10 Aug 2015 04:15 PM
cam.CoordinateFrame = CFrame.new(Vector3.new(place where cam should be), Vector3.new(place where cam looks at))
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
10 Aug 2015 04:15 PM
the Focus property

a good way to do this is set the CameraSubject to where you want the camera to look from, and set the camera's Focus property to where you want it to look at.

or you could do this

cam.CoordinateFrame = CFrame.new(vector3ToLookFrom, vector3ToLookAt)

either works
Report Abuse
Modoveex is not online. Modoveex
Joined: 21 Mar 2009
Total Posts: 8057
10 Aug 2015 04:17 PM
define torso, camera

camera.CameraType = 'Scriptable'
while wait() do
camera.CoordinateFrame = CFrame.new(torso.Position+Vector3.new(0,10,0),torso.Position)
end
Report Abuse
EmsyThorne is not online. EmsyThorne
Joined: 07 May 2015
Total Posts: 183
10 Aug 2015 04:22 PM
Okay. Coding in other areas I can handle very well.

Where do I add this into the script?
Report Abuse
Modoveex is not online. Modoveex
Joined: 21 Mar 2009
Total Posts: 8057
10 Aug 2015 04:25 PM
The end, because it's a loop.
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
10 Aug 2015 04:30 PM
while true do
game:GetService("RunService").RenderStepped:wait()
camera.CoordinateFrame = CFrame.new(lookFrom.Position, target.Position)
* CFrame.Angles(0, angle, 0)
-- * CFrame.new(0, 20, 20) don't think need it now
angle = angle + math.rad(0.5)

end

assuming you want to the camera look down at the target in the loop
Report Abuse
EmsyThorne is not online. EmsyThorne
Joined: 07 May 2015
Total Posts: 183
10 Aug 2015 04:30 PM
local target = workspace.Part
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.CameraSubject = target
local angle = 0

while wait() do
camera.CoordinateFrame = CFrame.new(target.Position) --Start at the position of the part
* CFrame.Angles(0, angle, 0) --Rotate by the angle
* CFrame.new(0, 20, 20) --Move the camera backwards 5 units

angle = angle + math.rad(0.5)

end

I really hate it when I have to ask for it to be added in for me, but this time I must. Where exactly is it going and what I'm typing?
Report Abuse
Modoveex is not online. Modoveex
Joined: 21 Mar 2009
Total Posts: 8057
10 Aug 2015 04:32 PM
@instawin
this seems simpler and more effective
while wait() do
camera.CoordinateFrame = CFrame.new(torso.Position+Vector3.new(0,10,0),torso.Position)
end
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
10 Aug 2015 04:32 PM
make an anchored, invisible brick for where you want the camera to look at the target, name it lookFrom
Report Abuse
EmsyThorne is not online. EmsyThorne
Joined: 07 May 2015
Total Posts: 183
10 Aug 2015 04:38 PM
local target = workspace.Part
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.CameraSubject = target
local lookfrom = workspace.LookFrom

local angle = 0

while true do
game:GetService("RunService").RenderStepped:wait()
camera.CoordinateFrame = CFrame.new(lookfrom.Position, target.Position)
* CFrame.Angles(0, angle, 0)
-- * CFrame.new(0, 20, 20) don't think need it now
angle = angle + math.rad(0.5)

end

So this is the script I'm using now.

It now rotates around the invisible lookfrom block
Report Abuse
Modoveex is not online. Modoveex
Joined: 21 Mar 2009
Total Posts: 8057
10 Aug 2015 04:43 PM
Try this

local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.CameraSubject = nil
local torso = game.Players.LocalPlayer.Character:FindFirstChild('HumanoidRootPart')

while game:GetService("RunService").RenderStepped:wait() do
camera.CoordinateFrame = CFrame.new(torso.Position+Vector3.new(0,10,0),torso.Position)
end
Report Abuse
EmsyThorne is not online. EmsyThorne
Joined: 07 May 2015
Total Posts: 183
10 Aug 2015 04:45 PM
Why torso?

It's circling the map from far above the player and far away from spawn?
Report Abuse
Modoveex is not online. Modoveex
Joined: 21 Mar 2009
Total Posts: 8057
10 Aug 2015 04:52 PM
I tried


local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.CameraSubject = nil
local torso = game.Players.LocalPlayer.Character:FindFirstChild('HumanoidRootPart')

while wait() do
camera.CoordinateFrame = CFrame.new(torso.Position+Vector3.new(0,15,0),torso.Position)
end


and it worked, apart from that player movement seems broken.
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
10 Aug 2015 04:55 PM
if my version didn't work, then try this

local lookFrom = workspace.LookFrom
local target = workspace.Part
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.CameraSubject = lookFrom
local angle = 0

while wait() do
camera.Focus = CFrame.new(target.Position)
camera.CoordinateFrame = CFrame.Angles(0, angle, 0)
--* CFrame.new(0, 20, 20) add that if you again but meh
angle = angle + math.rad(0.5)
end

??
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
10 Aug 2015 04:57 PM
also i would use renderstepped instead of wait without any arguments for your camera manipulation, as that allows you to yield for less time and still not crash the script

if the client is in good condition and not overloaded, theoretically, game:GetService("RunService").RenderStepped:wait() is 1/60th of a second

however, the amount of time you yield with RenderStepped depends on the FPS of client i believe
Report Abuse
Modoveex is not online. Modoveex
Joined: 21 Mar 2009
Total Posts: 8057
10 Aug 2015 04:59 PM
renderstepped didn't work so I replaced it in laziness
anyhow, you keep rotating the camera - it never settles.
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
10 Aug 2015 05:01 PM
i said that stuff about renderstepped because i realized i used wait() as well :P

just trying to give the best advice
Report Abuse
EmsyThorne is not online. EmsyThorne
Joined: 07 May 2015
Total Posts: 183
10 Aug 2015 05:06 PM
No, the camera goes weird...

Such a hard solution for a simple task
Report Abuse
instawin is not online. instawin
Joined: 04 Jun 2013
Total Posts: 8777
10 Aug 2015 05:07 PM
it's not a hard solution, it's just that i'm not good at this lmao

meh, maybe someone could help you more than i can
Report Abuse
EmsyThorne is not online. EmsyThorne
Joined: 07 May 2015
Total Posts: 183
10 Aug 2015 05:08 PM
I'll use the original script for now. Is there not a way to make the camera rotate 45 degrees with a single line?
Report Abuse
Modoveex is not online. Modoveex
Joined: 21 Mar 2009
Total Posts: 8057
10 Aug 2015 05:10 PM
45? Sorry..

local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.CameraSubject = nil
local torso = game.Players.LocalPlayer.Character:FindFirstChild('Head')

while wait() do
camera.CoordinateFrame = CFrame.new(torso.Position+Vector3.new(0,15,15),torso.Position)
end
Report Abuse
EmsyThorne is not online. EmsyThorne
Joined: 07 May 2015
Total Posts: 183
10 Aug 2015 05:14 PM
Okay.

What I'm trying to do is have a camera circle the map whilst looking down on the map. Your script, though helpful in another situation I have in the game, doesn't do that.
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