OldGoldie
|
  |
| Joined: 17 Aug 2010 |
| Total Posts: 8210 |
|
|
| 11 Jul 2015 12:30 AM |
I have a
while RunService.Stepped:wait() do
loop in a LocalScript causing it. It's for a custom camera, If I change it to a lower wait, or wait(), the camera doesn't look good at all. Is there a way I can get rid of the lag, and still make the camera look good?
There isn't any output but this script causes lag.
local intTick=tick() while RunService.Stepped:wait() do local dif=tonumber(tick()-intTick) --Main value used for handling script speed in game. intTick=tick() local Cx,Cy,Cz=(head.Position.x-cam.CoordinateFrame.x)*(dif*8),((head.Position.y+distance)-cam.CoordinateFrame.y)*(dif*8), (head.Position.Z-cam.CoordinateFrame.z-4)*(dif*8) cam.CoordinateFrame=CFrame.new(Vector3.new(cam.CoordinateFrame.x+Cx, cam.CoordinateFrame.y+Cy, cam.CoordinateFrame.z+Cz),Vector3.new(cam.CoordinateFrame.x+Cx,cam.CoordinateFrame.Y+Cy-8,cam.CoordinateFrame.Z+Cz+2)) end |
|
|
| Report Abuse |
|
|
Chrapnel
|
  |
| Joined: 01 Feb 2014 |
| Total Posts: 951 |
|
|
| 11 Jul 2015 12:32 AM |
e.e this is dodgy on so many levels
what kind of camera are you going for? |
|
|
| Report Abuse |
|
|
OldGoldie
|
  |
| Joined: 17 Aug 2010 |
| Total Posts: 8210 |
|
|
| 11 Jul 2015 12:37 AM |
Kind of like League of Legends' camera, it follows you from the sky, facing down on your head.
Example here: http://www.roblox.com/games/268544583/EpicPaperTowels-Place-Number-1 |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2015 01:03 AM |
I've made things like that, and it usually seems that it's laggy in Studio but not in-game. Have you tested it in-game? And if you have and it's still laggy, it may just be due to your connection.
~who's awesome? you're awesome! |
|
|
| Report Abuse |
|
|
OldGoldie
|
  |
| Joined: 17 Aug 2010 |
| Total Posts: 8210 |
|
|
| 11 Jul 2015 01:21 AM |
| Nevermind, I found the problem. |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2015 05:39 AM |
:D What wus it?
~who's awesome? you're awesome! |
|
|
| Report Abuse |
|
|
duckwit
|
  |
| Joined: 08 Aug 2008 |
| Total Posts: 1310 |
|
|
| 11 Jul 2015 05:52 AM |
Top Tip: When you want to synchronise the camera with a part whose physics are distributed (i.e. not exclusively local), use the :GetRenderCFrame() method of BasePart.
The ROBLOX client interpolates the physical information about the movement of parts so that it looks smoother than it actually is. When you refer to somePart.CFrame you're getting the CFrame of where it actually is in physical space. When you use somePart:GetRenderCFrame() you get the exact CFrame of where that part appears to be relative to the client.
This can help mitigate some the synchronicity issues when cameras follow a target. |
|
|
| Report Abuse |
|
|
|
| 11 Jul 2015 05:56 AM |
/\ Thanks dude, I'll use that in the future.
~who's awesome? you're awesome! |
|
|
| Report Abuse |
|
|