#camera when follow part cframe causes this weird glitchy effect.

81 messages · Page 1 of 1 (latest)

glossy ruin
#

Client Script:

--Camera moves around function
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = CFrame.new() * CFrame.Angles(0, 0, 0)

local function updatecamerapos()
    camera.CFrame = camerafollow.CFrame
    camera.CFrame = camera.CFrame * CFrame.Angles(math.rad(tilt),0,0)
end

tool.Equipped:Connect(function()
    --set debounce
    loopdebounce = true
    --camera moves around
    runservice:BindToRenderStep("updatecamerapos", Enum.RenderPriority.Camera.Value + 1, updatecamerapos)
end)

Server Script:

local camera = game.Workspace.CurrentCamera
local center = workspace.AC130_Workspace.FollowPart
local camerafollow = game.Workspace.AC130_Workspace.MainPart
local runservice = game:GetService("RunService")

--settings
local angle = 0
local speed = 0.5
local offset = CFrame.new(0,0,100)
--

local function updatepart() 
    camerafollow.CFrame = center.CFrame * CFrame.Angles(0,math.rad(angle),0) * offset
    angle += 1
    print(camerafollow.CFrame)
end

runservice.Stepped:Connect(function()
    updatepart()    
end)    


when i run the game and equip the tool, theres this wacky ass glitchy effect. i dont understand why its happening. the server and client scripts are above. i think it might be because RenderStep and Stepped are slighty off, but im not sure.

wooden cave
#

I have a suspicion it's this function, but that's just after a quick glance:

local function updatecamerapos()
    camera.CFrame = camerafollow.CFrame
    camera.CFrame = camera.CFrame * CFrame.Angles(math.rad(tilt),0,0)
end
#

It seems like setting the CFrame to two different values immediately one after another might cause some jitter.

glossy ruin
#

oh yeah thats true

#

should i combine the two cframes?

wooden cave
#

Why are you setting it to the camerafollow in the first place?

#

Sorry I'm trying to picture this 3d setting in my mind lol

glossy ruin
#

cause i want a part to continously rotate around another part, and only when i equip a tool the camera sort of taps into the part's view

wooden cave
#

Mkay, with that in mind lemme try and visualize what's going on lol

glossy ruin
#

lol

#

yeah take your time

wooden cave
#

Okay, after looking at it I think you MAY be right, it might be the timing.

glossy ruin
#

yeah

wooden cave
#

Combining the CFrame is also a nice idea though lol save some space

glossy ruin
#

lol yeah when im optimizing the script ill keep that in mind

wooden cave
#

Lemme do a mockup really quickly

glossy ruin
#

bet

glossy ruin
wooden cave
#

Both being on the same timing would be a good idea.

#

Before or after physics is up to you

glossy ruin
#

yeah

#

when i set both to heartbeat it doesnt work

#

when i set both to stepped it doesnt work

#

like, it zooms into the player

wooden cave
#

Hmm I'm not getting the jitter...

glossy ruin
#

with renderstepped and stepped?

wooden cave
#

YEah

glossy ruin
#

hmm

wooden cave
#
local center = workspace.AC130_Workspace.FollowPart
local camerafollow = game.Workspace.AC130_Workspace.MainPart

Are these the right ones?

#

Wouldn't you swap them?

glossy ruin
#

mainpart is the one that is being followed

wooden cave
#

Oh lol

glossy ruin
#

followpart is the one being rotated around

wooden cave
#

Wait, yeah

#

In your updatePart method camerafollow is being rotated. Which is the MainPart

#

What did you define camerafollow as in your client script?

#

I made it the FollowPart in mine

glossy ruin
wooden cave
#

Lemme rewrite my example now lol

glossy ruin
#

lol

wooden cave
#

lmao still no jitter

glossy ruin
#

BRO WHAT

#

wait show me your scripts

wooden cave
#

Localscript in Tool:

local camera = game.Workspace.CurrentCamera
local camerafollow = game.Workspace.AC130_Workspace.MainPart
local tool = script.Parent
local loopdebounce = false
local runservice = game:GetService("RunService")
local tilt = -45

--Camera moves around function
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = CFrame.new() * CFrame.Angles(0, 0, 0)

local function updatecamerapos()
    camera.CFrame = camerafollow.CFrame
    camera.CFrame = camera.CFrame * CFrame.Angles(math.rad(tilt),0,0)
end

tool.Equipped:Connect(function()
    --set debounce
    loopdebounce = true
    --camera moves around
    runservice:BindToRenderStep("updatecamerapos", Enum.RenderPriority.Camera.Value + 1, updatecamerapos)
end)

Server Script:

local center = workspace.AC130_Workspace.FollowPart
local camerafollow = game.Workspace.AC130_Workspace.MainPart
local runservice = game:GetService("RunService")

--settings
local angle = 0
local speed = 0.5
local offset = CFrame.new(0,100,100)
--

local function updatepart() 
    camerafollow.CFrame = center.CFrame * CFrame.Angles(0,math.rad(angle),0) * offset
    angle += 1
    print(camerafollow.CFrame)
end
runservice.Stepped:Connect(function()
    updatepart()    
end)    

Albeit I made some assumptions regarding some variables set in the localscript

glossy ruin
#

hippity hoppity ur code is my property

wooden cave
#

./shrug

glossy ruin
#

lmao nah im just fucking with you

wooden cave
#

Fixed it so the camera angle isn't shit lol

glossy ruin
#

lol

wooden cave
glossy ruin
#

hmmm now the part's movement stops midway

wooden cave
#

I can only imagine there's something else going on haha

glossy ruin
#

yeah lol

wooden cave
#

Well, if you absolutely care you can screenshare in a voice channel like General 2/3

regal sonnetBOT
#

studio** You are now Level 4! **studio

wooden cave
#

I've generally got time to kill

glossy ruin
#

but if i ever need help im cool with that

wooden cave
#

👍

glossy ruin
#

dammit yeah @wooden cave its fully fucked

#

i cant vc rn tho

#

ill dm you later

#

wheres the server script tho?

wooden cave
#

ServerScriptService

glossy ruin
#

ohh okay

#

ok its kind of fixed now

wooden cave
#

ayeeee lmao

glossy ruin
#

yesss fixed

#

fully fixed

wooden cave
#

Don't ask me why it matters where that is

glossy ruin
#

i love you man

wooden cave
#

Something about timing idk

glossy ruin
#

youve saved my project like twice already 💀

wooden cave
#

Roblox was different in my time 👴

glossy ruin
#

lmao

wooden cave
#

It was never dead my man. You just hit a small bump

#

😉

glossy ruin
#

lmao