Camera Panning Slightly for a menu screen

Its a local script. All done through the client.

Then there is something wrong with finishedintro. Where is that variable?

Is just labeled at the beginning of the script as

 local finishedintro = false

Which is set true at the end of the intro.

Ughh i just got it, i removed the defaultcframe.p +mousemove and just did mousemove. Now my next question is, if i wana do it with rotation instead of cframe, cause its moving up and down i want it to rotate slightly, would i use cameraangles?

1 Like

Just so we can get a overview, can you post your latest version of your code?

1 Like
game:GetService("RunService").RenderStepped:Connect(function()
	Camera.Focus = DefaultCFrame
	local Center = Vector2.new(Camera.ViewportSize.X/2, Camera.ViewportSize.Y/2)
	local MoveVector = Vector3.new((Mouse.X-Center.X)/Scale, -(Mouse.Y-Center.Y)/Scale, 0)
	
	Camera.CFrame = DefaultCFrame * CFrame.new(MoveVector)
end)

i’m experimenting with using mouse.origin.p or something to get the vector 3 from the cam pos, and shift it. The problem was before it was multiplying the default cframe by defaultcframe.p+mousevector which was throwing it some where else in the game that has nothing but space. I removed the defaultcframe.p and i got what i want, but it pans only movement by a little bit, i want just rotation centered at the defaultcframe

I just saw that you used the code of a similar question post, but were missing one line in Camera.CFrame, maybe it’s worth a try adding it?

Camera.CFrame = DefaultCFrame * CFrame.new(DefaultCFrame.p + MoveVector)

Thats what it was before. When i removed defaultcframe.p and just multiplied it by movevector is when it worked. The prople was when it multiplied the defaultcframe.p+movevector, it took me somewhere random in space, it multiplied the cframe vectors strangely, and sent the cam some random cframe vector far far away in space. it was working when i removed defaultcframe.p, its just not quite what i want. It pans only horizontally and vertically, i want it only to move rotationally slightly instead.

It might be just a guess, but maybe try this, it might also not work:

Camera.CFrame = DefaultCFrame * CFrame.Angles(math.rad(MoveVector.X), math.rad(MoveVector.Y), math.rad(MoveVector.Z))

You might also need to switch around the values or replace some with 0.

9 Likes

IT WORKS… mosty. XD I just gotta play with the variables to make sure they do what i need them to do. You’re my hero thanks! I will let you know if something comes up.

4 Likes

The reason of why it works is because previously you were just multiplying the CFrame Position with your MoveVector, this time you are multiplying the CFrame Orientation.

To read more about CFrames, I suggest reading these Developer Hub Articles:
https://developer.roblox.com/en-us/articles/Understanding-CFrame
https://developer.roblox.com/en-us/api-reference/datatype/CFrame

3 Likes