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: If I wanted the camera to smoothly follow to a spot

Previous Thread :: Next Thread 
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
06 Apr 2013 10:55 AM
Would I just attach the camera to a part and move the part by CFrame?
Report Abuse
getkoed2 is not online. getkoed2
Joined: 11 Apr 2010
Total Posts: 1144
06 Apr 2013 11:15 AM
I guess you could set the CameraSubject to that part, then change the CoordinateFrame to your likings and make the CameraType Scriptable.
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
06 Apr 2013 11:16 AM
This would be the equivalent of moving the Camera by CFrame. You could use BodyPosition/BodyVelocity for smoother Camera movement.
Report Abuse
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
06 Apr 2013 11:19 AM
Oh wait, I just found out the Method "Interpolate", going to find a tutorial on dat.
Report Abuse
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
06 Apr 2013 11:20 AM
Dang it they dun haz any tutorials on it.
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
06 Apr 2013 11:24 AM
Linear interpolation. Used by vectors. It still doesn't solve the jerkyness of the Camera. The only way you can do this is if you move the camera slowly (by around 0.01 units per cycle).
Report Abuse
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
06 Apr 2013 11:26 AM
Dang eet.
Report Abuse
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
06 Apr 2013 11:28 AM
Lol k since I'm to lazy to figure out what the 2nd argument of interpolation then Ima go try Camera CFraming.


Lol joo can manipulate Camera with Body Objects?
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
06 Apr 2013 11:33 AM
No.

The second argument is a percentage value. That's all.
1 is 100%.
Report Abuse
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
06 Apr 2013 11:40 AM
Oh, k I have officially learned CoordinateFrame, now how would I do the math to get it to do that?
Report Abuse
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
06 Apr 2013 12:52 PM
Oh wait, I just realized I could +/- the X value until it matches with the other X value, then do the same thing with Z value.

Report Abuse
evolvedpikachu is not online. evolvedpikachu
Joined: 18 Aug 2010
Total Posts: 10696
06 Apr 2013 01:13 PM
Ok I finally did it, but its faulty and makes the camera jerky (not the full script!):

local Player = script.Parent.Parent

function onKeyDown(key)
elseif key == "r" then
local cam = game.Workspace.CurrentCamera
local p = game.Workspace.SpawnLocation.Position
local a = cam.CoordinateFrame
print(cam.CameraType)
cam.CameraType = "Scriptable"
while cam.CoordinateFrame ~= p do
wait(0.1)
if a.X - p.X < 0 then
wait(0.1)
cam.CoordinateFrame = CFrame.new(a.X + 0.1,a.Y,a.Z)
elseif a.X - p.X > 0 then
wait(0.1)
cam.CoordinateFrame = CFrame.new(a.X - 0.1,a.Y,a.Z)
elseif a.Z - p.Z < 0 then
wait(0.1)
cam.CoordinateFrame = CFrame.new(a.X,a.Y,a.Z + 0.1)
elseif a.Z - p.Z > 0 then
cam.CoordinateFrame = CFrame.new(a.X,a.Y,a.Z - 0.1)
end
end

function onKeyUp(key)
elseif key == "r" then
local pos = script.Parent.Parent.Character.Head.Position
local cam = game.Workspace.CurrentCamera
cam.CoordinateFrame = CFrame.new(pos.X,pos.Y,pos.Z)
cam.CameraType = "Custom"
end

local Mouse = Player:GetMouse()
Mouse.KeyDown:connect(onKeyDown)
Mouse.KeyUp:connect(onKeyUp)
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