|
| 24 Oct 2016 12:54 PM |
I made a custom smooth camera, but for some reason it is very shaky as the character walks, my ocd is killing me, the character appear as if he's slightly vibrating. Try it out for yourself and look closely at the character, this is so annoying how can I fix it?
wait() local player = game.Players.LocalPlayer.Character local cam = workspace.CurrentCamera
cam.CameraType = Enum.CameraType.Scriptable
game:GetService("RunService").RenderStepped:connect(function() cam:Interpolate(player.Head.CFrame + player.Head.CFrame:vectorToWorldSpace(Vector3.new(0,2,5)),player.Head.CFrame - player.Head.CFrame:vectorToWorldSpace(Vector3.new(0,0,5)),0.075) end)
|
|
|
| Report Abuse |
|
|
| |
|
Quebankus
|
  |
| Joined: 25 Aug 2011 |
| Total Posts: 846 |
|
|
| 24 Oct 2016 01:34 PM |
| I din't try it but maybe it's caused by the player animation. Try moving the camera based on HumanoidRootPart instead of the head, since it doesn't move with animations. |
|
|
| Report Abuse |
|
|
Quebankus
|
  |
| Joined: 25 Aug 2011 |
| Total Posts: 846 |
|
|
| 24 Oct 2016 01:38 PM |
| Tried it before and after fix, the results are very satisfying to me. |
|
|
| Report Abuse |
|
|
|
| 24 Oct 2016 04:16 PM |
Same results. I set the alpha to a much lower number and you can see it very well while walking sideways, go into studio, insert this script and walk sideways and you will see what I mean.
wait() local player = game.Players.LocalPlayer.Character local cam = workspace.CurrentCamera
cam.CameraType = Enum.CameraType.Scriptable
game:GetService("RunService").RenderStepped:connect(function() cam:Interpolate(player.HumanoidRootPart.CFrame + Vector3.new(0,4,5),player.HumanoidRootPart.CFrame - Vector3.new(0,0,5),0.001) end)
|
|
|
| Report Abuse |
|
|
|
| 24 Oct 2016 04:28 PM |
| Use CFrame:Lerp instead of interpolate and also why not just move it to the position of the head and then move it locally backwards a bit? |
|
|
| Report Abuse |
|
|
|
| 24 Oct 2016 04:43 PM |
CFrame:lerp produces same results and the point of lerping is making it smooth, I want to make the camera lag behind the player, setting the position of it a bit behind the player wouldn't make the effect of it lagging behind him.
|
|
|
| Report Abuse |
|
|
|
| 24 Oct 2016 04:47 PM |
| I believe since you're using RunService (forgive me if I'm wrong here) there will be a slight delay between when it actually runs the code. It would be that way with everything though, which is a shame but it looks pretty nice so far :) |
|
|
| Report Abuse |
|
|
|
| 24 Oct 2016 08:23 PM |
So there is no way of fixing it? I'm trying to imitate the camera lag option that is available in Unreal Engine 4 :/
|
|
|
| Report Abuse |
|
|
East98
|
  |
| Joined: 17 Jun 2012 |
| Total Posts: 418 |
|
|
| 24 Oct 2016 08:27 PM |
Use RunService:BindToRenderStep(). This will update the camera every frame and therefor it will not be shaky unless you have a very low frame rate (lag). Dont use lerp of interpolate as these (like 80% sure on this one) only update the camera every other frame also known as a heartbeat.
--East98 |
|
|
| Report Abuse |
|
|
|
| 24 Oct 2016 08:40 PM |
So I did this and it's literally the same :/
wait() local player = game.Players.LocalPlayer.Character local cam = workspace.CurrentCamera
cam.CameraType = Enum.CameraType.Scriptable
game:GetService("RunService"):BindToRenderStep("Camera", Enum.RenderPriority.Character.Value, function() cam.CFrame = cam.CFrame:lerp(CFrame.new(player.HumanoidRootPart.CFrame.p + Vector3.new(0,4,5), player.HumanoidRootPart.CFrame.p - Vector3.new(0,0,5)), 0.2) end)
|
|
|
| Report Abuse |
|
|
East98
|
  |
| Joined: 17 Jun 2012 |
| Total Posts: 418 |
|
|
| 24 Oct 2016 08:43 PM |
| Ok i dont see why youre using lerp though... Just set the cameras position to where you want it to be. If you want it above the characters head just say cam.CoordinateFrame = CFrame.new((player.Character.Head.CFrame * Vector3.new(0,4,5)),player.Character.Head.CFrame.p) |
|
|
| Report Abuse |
|
|
UFAIL2
|
  |
| Joined: 14 Aug 2010 |
| Total Posts: 6905 |
|
|
| 24 Oct 2016 08:43 PM |
a) Use RenderPriority.Camera b) Don't lerp (like east suggested). |
|
|
| Report Abuse |
|
|
|
| 24 Oct 2016 08:44 PM |
I have said many times that I'm using lerp so it lags behind smoothly not just snaps behind the players head once he starts moving. I'm trying to do this https://www.youtube.com/watch?v=0w6BzHIkFow
|
|
|
| Report Abuse |
|
|
East98
|
  |
| Joined: 17 Jun 2012 |
| Total Posts: 418 |
|
|
| 24 Oct 2016 08:48 PM |
This would be one way...
game:GetService("RunService"):BindToRenderStep("Camera", Enum.RenderPriority.Character.Value, function() wait(1) --This will be the lag cam.CFrame = CFrame(--[[Insert your cframe here]]--) end)
Otherwise have the CFrame be a CFrame looking at the player and multiply the magnitude of the CFrame by a certain scale and this way it will approach the player slowly |
|
|
| Report Abuse |
|
|
|
| 24 Oct 2016 08:50 PM |
Here's some crappy code that I quickly wrote; should work.
local Game = game local Player = Game:GetService("Players").LocalPlayer local Head = (Player.Character or Player.CharacterAdded:wait()):WaitForChild("Head") local Camera = Game:GetService("Workspace").CurrentCamera local CFrame = CFrame local CameraOffset = (CFrame.new(0, 8, 6) * CFrame.Angles(-math.rad(30), 0, 0)) local Scriptable = Enum.CameraType.Scriptable local RenderStepped = Game:GetService("RunService").RenderStepped
while (Camera.CameraType ~= Scriptable) do Camera.CameraType = Scriptable RenderStepped:wait() end
while true do Camera.CFrame = Camera.CFrame:lerp((Head.CFrame * CameraOffset), 0.05) RenderStepped:wait() end |
|
|
| Report Abuse |
|
|
|
| 24 Oct 2016 08:56 PM |
sadly nothing helps, oh well, roblox's fault once again :/
|
|
|
| Report Abuse |
|
|
|
| 24 Oct 2016 09:00 PM |
| You're either trolling or very dumb. I just tested it and it works fine. |
|
|
| Report Abuse |
|
|
|
| 24 Oct 2016 09:45 PM |
Explain this then https://www.youtube.com/watch?v=5-42lAYBZkk
|
|
|
| Report Abuse |
|
|
|
| 24 Oct 2016 09:47 PM |
It worked fine for me. Here, I'll write it to work with ROBLOX animations.
local Game = game local Player = Game:GetService("Players").LocalPlayer local HumanoidRootPart = (Player.Character or Player.CharacterAdded:wait()):WaitForChild("HumanoidRootPart") local Camera = Game:GetService("Workspace").CurrentCamera local CFrame = CFrame local CameraOffset = (CFrame.new(0, 9.25, 6) * CFrame.Angles(-math.rad(30), 0, 0)) local Scriptable = Enum.CameraType.Scriptable local RenderStepped = Game:GetService("RunService").RenderStepped
while (Camera.CameraType ~= Scriptable) do Camera.CameraType = Scriptable RenderStepped:wait() end
while true do Camera.CFrame = Camera.CFrame:lerp((HumanoidRootPart.CFrame * CameraOffset), 0.05) RenderStepped:wait() end
|
|
|
| Report Abuse |
|
|
|
| 24 Oct 2016 09:50 PM |
Same thing.. I just give up
|
|
|
| Report Abuse |
|
|
|
| 24 Oct 2016 09:51 PM |
| Then it appears that ROBLOX has no character parts that the default animations don't apply to. My suggestion? Use the head's position, then manually calculate the rotation. |
|
|
| Report Abuse |
|
|
Salinas23
|
  |
| Joined: 28 Dec 2008 |
| Total Posts: 37141 |
|
|
| 24 Oct 2016 09:53 PM |
my ocd won't let me let you use 'player' as the Character's variable
local player = game:GetService("Players").LocalPlayer local char = player.Character local cam = workspace.CurrentCamera
|
|
|
| Report Abuse |
|
|
|
| 24 Oct 2016 09:54 PM |
It's not about the rotation, the lerp is the thing that is messed up, but whatever
|
|
|
| Report Abuse |
|
|
|
| 24 Oct 2016 09:55 PM |
@Salinas23 it's suppose to be a local script
|
|
|
| Report Abuse |
|
|