this is pretty much the effect i’m trying to do
If I correctly understand what you are trying to achieve, Roblox has example code to do something like what you want in their new document system. Take a look here: Humanoid | Roblox Creator Documentation. It’s right at the top of the page. Here’s the code they are using:
local RunService = game:GetService("RunService")
local playerModel = script.Parent
local humanoid = playerModel:WaitForChild("Humanoid")
local function updateBobbleEffect()
local now = tick()
if humanoid.MoveDirection.Magnitude > 0 then -- Is the character walking?
local velocity = humanoid.RootPart.Velocity
local bobble_X = math.cos(now * 9) / 5
local bobble_Y = math.abs(math.sin(now * 12)) / 5
local bobble = Vector3.new(bobble_X, bobble_Y, 0) * math.min(1, velocity.Magnitude / humanoid.WalkSpeed)
humanoid.CameraOffset = humanoid.CameraOffset:lerp(bobble, 0.25)
else
-- Scale down the CameraOffset so that it shifts back to its regular position.
humanoid.CameraOffset = humanoid.CameraOffset * 0.75
end
end
RunService.RenderStepped:Connect(updateBobbleEffect)
I personally haven’t tried this, but I hear it makes a good bobble effect when the player is walking.
My end goal is to simply add Blue’s CFrame, but roblox complicates that. I don’t feel like giving up any time soon, I will keep trying.
If the video represents what you are after, can you just set the camera to scriptable and set the camera.CFrame equal to the blue.CFrame?
camera.CameraType = Enum.CameraType.Scriptable
runService.RenderStepped:Connect(function()
camera.CFrame = blue.CFrame
end)
That will put the camera at blue with it looking at pink and doing everything else the blue one is doing. Is there something else it’s supposed to do?
That’s exactly what I did but just to represent what I wanted while still being able to move the camera myself.
ToEulerAnglesXYZ returns 3 numbers: an X, Y and Z rotation.
When you do CFrame1:ToEulerAnglesXYZ() * CFrame2:ToEulerAnglesXYZ() you’re multiplying the first angle of each one (x) together. Then, you’re giving that number to the CFrame.Angles constructor. However, the CFrame.Angles constructor wants 3 arguments, not one, so that’s why you’re getting that error.
There’s a couple fixes, but it seems like you want to apply the orientation of the blue cube to the camera. It can be done like this:
runService.RenderStepped:Connect(function()
camera.CFrame = CFrame.new(camera.CFrame.Position) * (blue.CFrame - blue.CFrame.Position)
end)
thats pretty close, but I can’t move the camera myself.
The issue is the render priority not the code. Change the renderstepped function to a BindToRenderStep and set the RenderPriority parameter to Enum.RenderPriority.Camera.Value + 1
So how is your video different than what you want? If you show a video that is exactly what you want except for… it’s really the part that comes next that is critical. It’s not particularly helpful to say that something is essentially what you want and leave the missing parts unsaid. Same with posting code; seeing what you’re doing is nice, but it’s not as helpful as it could be if what you are trying to do isn’t already in there. I think the main thing standing in the way of a solution is the lack of a clear sense of what you are trying to achieve. There are likely a bunch of coders here who could suggest a viable solution once the objectives are clearly defined. Playing twenty questions or waiting for someone to stumble onto the answer is a somewhat slow way to go about this. Not meaning to lecture. Is mostly observation meant as constructive criticism.
Sorry for confusing everyone. I know I haven’t been very clear on everything so I’m going to try to explain it in as much detail as I can. So the whole thing that I’m trying to achieve is some camera bobbing effect.
I have tried everyone’s ideas, but sorry if I forgot to get back to you. Basically what I need is for these two images blended together to make the camera completely movable like normal, but with the bobbing added onto that. Sorry if you find this video disorienting, it was the best I could do idk how to edit
I think a better example would be this one. I did this by making the blues position 10 studs away from pink, which is moving via prismaticConstraint.