Roblox Studio's camera has a 'Zoom To' action by pressing F, how do I replicate this in a plugin? [SOLVED]

Hey! Thanks for visiting this post, and another thanks for when you reply.

The goal

  • I want to replicate the Studio’s ‘Zoom To’ action in a plugin, like this:
    RobloxStudioBeta_2Ue1vQZ3TM

The issue

  • I have little knowledge about plugin API
  • I have little knowledge about studio’s camera manipulation using plugin

The tried-and-failed

  • Using CFrame.lookAt works a little, but it doesn’t set the camera’s pivot point to the subject.
    (This is my attempt of a minimum viable solution)
workspace.CurrentCamera.CFrame = CFrame.lookAt(subject.Position + Vector3.new(0,0, -5), subject.Position

RobloxStudioBeta_rY2JwmKA67

  • Setting camera subject doesn’t work; it does nothing.
workspace.CurretCamera.CameraSubject = subject

Extras

  • I know I’m not the only one facing this, @xsixx’s Moon Animator plugin also tries to replicate the same behavior, which partly works, but the pivot point becomes wierd.

whoops, I kinda made the GIF too long & its file size too big, now I’m too lazy to recapture the GIF, but it works like the 2nd GIF

Unrelated stuff
  • On a side note, I reccommend you to dump Gyazo and use ShareX, much more features without paying anything. :stuck_out_tongue:
  • I noticed you can pause / unpause local GIF files by clicking on it, cool.

TL; DR

  • when press F, cam orbits around object. how do this with plugin?

Maybe try setting the focus?

local cam = workspace.CurrentCamera
cam.CFrame = CFrame.lookAt(subject.Position + Vector3.new(0,0, -5), subject.Position)
cam.Focus = subject.CFrame

What you’re asking may be impossible, though.

1 Like

Hm, I don’t think that’s it…

However, thanks for the suggestion!

I refuse to believe this is impossible to replicate. >:^O

EDIT:

WAIT NEVERMIND FOCUS DOES EXACTLY THIS, HAHA

THANKS!

Focus is a CFrame property by the way, not Position

it doesn’t change the Camera’s position, just the pivot point

anyways @xsixx you can fix your plugin now :^P

RobloxStudioBeta_1PEmemnIia

1 Like

Did you switch the camera’s mode to ‘Custom’ before attempting to set its subject?

hehe tl;dr person detected : P

anyways I solved it; see my reply to the ‘Solution’ post