Make security camera turn realistically

I have a security camera and I put a test spin script in it, but the camera rotates in a weird way. Is there any way to make it look like its spinning from the pole, if you know what I mean? Just like a real life security camera.

Help is appreciated! Thanks in advance.

3 Likes

I’m pretty sure you need to change the anchor point of your camera model (only the part that spins) and align it with the pole thing. Have you tried that? If you do it, the camera should rotate from the given anchor point, and it will not look weird. Your anchor point is probably in the middle, which makes it rotate along with its middle point and not the point of the pole.

You can’t change that, I believe.

No, you can, it’s called PivotOffset.
Look the video below, see how it rotates along side the point I gave it? You need that.

Is there a way to set that with a script?

(I never use pivots so I don’t know a lot about them)

Sadly you can’t, it’s not scriptable. You can check that in the documentation.
You need to do it manually from studio as far as I know.

Nvm I just found it

1 Like

Well actually there is :PivotTo(), but I’m not sure if that will work.

Yeah, I just noticed that, but it’s recommended to do it manually from Studio, but if you really need to script it that badly then I guess that is what you need.

Well I tried setting the pivot in studio but it didn’t work.

I have the pivot set and it works in studio but not when I run the game. Any ideas why? I’m using CFrame.Angles to rotate it.

1 Like

Not sure if CFrame.Angles is the best way to do it. Maybe try another method?
Here are some:

fromEulerAnglesXYZ is the exact same thing as Angles

1 Like

Maybe try the origin instead of CFrame? I have no idea myself.

This isn’t working. I’m just going to show my code.

local RunService = game:GetService('RunService')

local Movable = script.Parent
local Primary = Movable.PrimaryPart

RunService.Heartbeat:Connect(function()
	Primary.CFrame = Primary.CFrame * CFrame.Angles(math.rad(0), math.rad(0.10), math.rad(0))
end)

The tweening/rotating with CFrame doesn’t automatically “consider” the pivot. You should take pivot as an offset

How do I do that?
character limit

Have you tried this? Rotating a part using pivot points - #3 by KJry_s

I got it to work by reading some documentation. I just created a small part where I wanted the pivot to be and made it the PrimaryPart of the model. Then, I changed the CFrame of that part with a script.

It is working perfectly right now. Hopefully this helps others.

1 Like