So is like combination of moving background but player still can move the camera a little bit even if the previous tween (moving background) still playing
Or is it okay to record video of this game just couple part of it and show, so u can really see what I want to make?
Iām too tired to give a solution, but try looking into lerping between two cframes and adding the mouse rotation/
Is like this, u can see is moving but when moving, player can still control the camera a little bit of with mouse
I probably understand you. I think you want the tween not to override the cframe completely, it should only offset it so the player can move the camera too.
Well thatās probably impossible with tween service, you should use some CFrame math, and here is a solution I made myself for a topic:
How would I offset the camera with rotation? - Help and Feedback / Scripting Support - DevForum | Roblox
How to apply it like a tween? If I see you change the rotation not the position, If Iām not mistaken? correct me if iām wrong i donāt really understand
Well is like combination of my script with this video
itās a bit hard, since you need a great understanding of cframe math and other stuff, However let me give you some resources to help you out
First of all, my video can give you a basic understanding of how cframes work here:
Secondly you need to understand this functions:
TweenService:GetValue (roblox.com)
and
CFrame (roblox.com)
CFrame CFrame:Lerp ( CFrame goal, number alpha )
And finally checkout this topic that I shared before:
How would I offset the camera with rotation? - Help and Feedback / Scripting Support - DevForum | Roblox
My solution use CFrame math, so it works for CFrame position and rotation, not just rotation!
Otherwise I might be able to make a video on how to do it later
So I need to use CFrame:Lerp right? Well if you can make video Iām gonna feel thankful, but thatās on you, once again thank you.
local oldOffset = CFrame.new() -- Don't edit this!
local offset = CFrame.new()
-- (Optional): Will accumulate the time in seconds since the script started
local t = 0
game:GetService("RunService").RenderStepped:Connect(function(delta)
-- (Optional): Accumulate the time in seconds
t += delta
-- Cancel out the offset we applied in the previous frame
cam.CFrame *= oldOffset:Inverse()
-- Apply the new offset
cam.CFrame *= offset
-- Store the offset we have applied so we cancel it in the next frame
oldOffset = offset
-- Update the offset that will applied!
offset = CFrame.Angles(math.sin(t), 0, 0) --You can change this however you want!
-- Proof (Optional): You can update the original cframe without affecting the offset
cam.CFrame *= CFrame.new(math.sin(t)*10, 0, 0) --You can change this however you want!
end)
Ahh so this is your script right? So you mean by it can also for position is like changing the offset lets say
offset = CFrame.new(math.rad(45), 0, 0)
Yes, let me clarify what each thing is for:
1 - My video will help you to start understanding cframes at a basic level and give you the resources to build on what I taught (in video description)
2 - TweenService:GetValue, you can give it the alpha (percentage from 0 to 1), easingStyle and easingDirection and it will give you back a new alpha (percentage from 0 to 1) value depending on the easingStyle and easingDirection.
3 - CFrame:Lerp(), you need to use it with the solution I provided in the last link with the alpha value you got from TweenService in step 2.
4 - Enjoy!
But can I implement it because I have more than one part, i can use the same as my script?
Like for i, v in pairs(CameraScenes:GetChildren()) do
then do the CFrame:Lerp inside it?
Possibly, am not exactly sure what youāre trying to do
but my script gives you a extra cframe that you can control without overriding the original cframe.
I guess, you need multiple offsets built on each other, but let me know what youāre trying to do exactly, maybe like a demo video or game?
Have you see the link that I gave above?
Also lerp is like this?
game:GetService("RunService").RenderStepped:Connect(function()
for i, v in pairs(CameraScenes:GetChildren()) do
cam.CFrame = v["1"].CFrame
cam.CFrame = cam.CFrame:lerp(v["2"].CFrame, 0.5)
end
end)
I just played the game, now I know exactly what youāre talking about.
I made something like it before years ago for a commission, Iāll try to make a video soon!