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 it possible to "spin" the camera?

Previous Thread :: Next Thread 
Stithos is not online. Stithos
Joined: 09 Apr 2014
Total Posts: 40
24 Apr 2015 10:24 PM
I want the camera to remain in one spot, gradually turn upside-down, and continue turning until the camera is back where it started, making a full circular spin.

I've tried experimenting with different camera types and different values in CoordinateFrame, but nothing seems to actually spin the camera in the way that I'd like.

Since my script also makes the character spin, I tried making the camera lock onto the head, and it locks onto the head, but it just follows it while remaining upright.

I know that you can sort of rotate the camera when it's facing down, but I'd like the camera to be following the character while it's spinning.

If you're still unsure of what I mean, this guy did it in his place: http://www.roblox.com/games/210650642/Grass-Simulator
I want it like that without the zooming in and out.

Here's what I have so far:

i=0
while wait() do
game.Players.LocalPlayer.Character.HumanoidRootPart.RootJoint.C1 = CFrame.Angles(math.pi/2, math.pi+i, 0)
--Workspace.CurrentCamera.CameraType = something
--Workspace.CurrentCamera.CoordinateFrame = something
i=i+0.1
end

Any help is appreciated!
Report Abuse
Chrapnel is not online. Chrapnel
Joined: 01 Feb 2014
Total Posts: 951
24 Apr 2015 10:25 PM
did you try making the cameratype "scriptable"?
Report Abuse
EchoReaper is online. EchoReaper
Joined: 14 Oct 2008
Total Posts: 4323
24 Apr 2015 10:28 PM
local camera = workspace.CurrentCamera
camera.CameraType = "Scriptable"
local start = camerea.CoordinateFrame
for i=1,360 do
camera.CoordinateFrame = CFrame.new(start.p, (start * CFrame.Angles(math.rad(i),0,0) * CFrame.new(0,0,-1)).p)
end
camera.CameraType = "Custom"
Report Abuse
EchoReaper is online. EchoReaper
Joined: 14 Oct 2008
Total Posts: 4323
24 Apr 2015 10:29 PM
Oh, and add a wait in there
Report Abuse
Stithos is not online. Stithos
Joined: 09 Apr 2014
Total Posts: 40
24 Apr 2015 10:35 PM
@Chrapnel
Yeah, I fixed the camera to the head, but when it spun the camera stayed upright

@EchoReaper
Didn't work, camera stayed still.
Report Abuse
EchoReaper is online. EchoReaper
Joined: 14 Oct 2008
Total Posts: 4323
24 Apr 2015 10:55 PM
Because you didn't add a wait and it completed instantly. Add a wait to the loop.
Report Abuse
Stithos is not online. Stithos
Joined: 09 Apr 2014
Total Posts: 40
24 Apr 2015 11:01 PM
@EchoReaper

I did.
I added a wait() and fixed the spelling of "camerea"
It still didn't work.
Report Abuse
iHin is not online. iHin
Joined: 06 Apr 2014
Total Posts: 407
24 Apr 2015 11:03 PM
wait() is basically instantaneous... add a value to the wait...



-𝒩 | iHin, Scripter
Report Abuse
Stithos is not online. Stithos
Joined: 09 Apr 2014
Total Posts: 40
24 Apr 2015 11:08 PM
@iHin
It's not instantaneous if it's repeated 360 times.
BTW I changed it to wait(1) and it still didn't work.
Report Abuse
EchoReaper is online. EchoReaper
Joined: 14 Oct 2008
Total Posts: 4323
24 Apr 2015 11:18 PM
You're putting wait() as the very last line in the for loop, right?

It's working just fine for me.
Report Abuse
Stithos is not online. Stithos
Joined: 09 Apr 2014
Total Posts: 40
24 Apr 2015 11:22 PM
Yep. Here's the exact script that I'm trying to use, in a localscript in startergui:

local camera = workspace.CurrentCamera
camera.CameraType = "Scriptable"
local start = camera.CoordinateFrame
for i=1,360 do
camera.CoordinateFrame = CFrame.new(start.p, (start * CFrame.Angles(math.rad(i),0,0) * CFrame.new(0,0,-1)).p)
wait()
end
camera.CameraType = "Custom"
Report Abuse
FlyScript is not online. FlyScript
Joined: 05 Aug 2010
Total Posts: 2884
24 Apr 2015 11:32 PM
There are two ways of doing this. The camera actually has a property for it if you just want it to spin the once:

cam:SetRoll(math.rad(90))--sets the camera to 90 degrees

I'm not sure if you have to make the cam scriptable for that or not, but just while loop and set the roll dude.

or, you can have the camera fully follow a brick in all axis:

function camFollow(part)
cam.CameraType = Enum.CameraType.Scriptable
local rs = game:GetService("RunService").RenderStepped
while true do
cam.CoordinateFrame = part.CFrame
rs:wait()
end
end

camFollow(game.Workspace.SpinnyThing)
Report Abuse
Stithos is not online. Stithos
Joined: 09 Apr 2014
Total Posts: 40
24 Apr 2015 11:37 PM
@FlyScript

Worked! Thanks.

For reference, this is my finished product:

i=0
y=1
local camera = game.Workspace.CurrentCamera
while wait() do
camera.CameraType = "Scriptable"
camera.CoordinateFrame = CFrame.new(game.Players.LocalPlayer.Character.Torso.Position)*CFrame.new(0,0,10)
camera:SetRoll(math.rad(y))
game.Players.LocalPlayer.Character.HumanoidRootPart.RootJoint.C1 = CFrame.Angles(math.pi/2, math.pi+math.rad(i), 0)
y=y+1
i=i+1
end
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