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: Scriptable Camera, Moving Objects

Previous Thread :: Next Thread 
Hyperion333 is not online. Hyperion333
Joined: 24 Dec 2009
Total Posts: 1436
06 Dec 2015 02:09 PM
I'm currently trying with a fast loop always updating the cameras position to follow the part. However once the camera position changes the part moves before the next change and it looks weird like its not synced.

How do I make a scriptable camera follow a moving object and remove this problem?
Report Abuse
wonderful72pike is online. wonderful72pike
Joined: 13 Jul 2010
Total Posts: 7009
06 Dec 2015 02:10 PM
Hook it to RenderStepped, or use Interpolate to make it a smooth transition no matter what.
Report Abuse
Hyperion333 is not online. Hyperion333
Joined: 24 Dec 2009
Total Posts: 1436
06 Dec 2015 02:12 PM
Thank you, I'll look into that. If you could write an example i'd appretiate it.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
06 Dec 2015 02:20 PM
If the Object in question is controlled by the local player (Such as it being part of the Character, or a LocalPart, etc) then all you really need to do is set it like this.

game:GetService("RunService").RenderStepped:connect(function()
-- Set position here.
end)


If the Object is controlled by the server, you will need to interpolate, because latency, network data needing to be re-sent due to being corrupt, and stuff like that.
Report Abuse
wonderful72pike is online. wonderful72pike
Joined: 13 Jul 2010
Total Posts: 7009
06 Dec 2015 02:20 PM
Here's my script:

local camera = workspace.CurrentCamera
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local character = workspace:WaitForChild(player.Name)
local torso = character:WaitForChild("Torso")
local hum = character:WaitForChild("Humanoid")

local Frame = game:GetService("RunService")


camera.CameraType = "Scriptable"
Frame.RenderStepped:connect(function()
if (hum.Health == 0) then
return
end
camera:Interpolate(
CFrame.new(torso.Position.X - 0.001, torso.Position.Y + 50, torso.Position.Z),
CFrame.new(torso.Position.X,
0,
torso.Position.Z),
0.03
)
end)

--------------
And here's how the final result looks:

http://www.roblox.com/games/179250490/Model-Making-Place-Showcase
Report Abuse
Hyperion333 is not online. Hyperion333
Joined: 24 Dec 2009
Total Posts: 1436
06 Dec 2015 02:28 PM
Thanks for the help.
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