Few questons about camera

Hi,
really sry, that I am frequently posting here.
But back to topic, so I need to do few things with camera, but idk how. I sheared google and nothing (but I am extremly bad at googling, so there can be some result).

  • Set camera max rotate, so client can rotate it only from -20 to 20 degrees.

  • Force shift lock on. [SOLVED by @return_end1]

  • When the camera is focused on parabolic object, it will rotate around it.


    Now, the camera will rotate around green circle, but I need to rotate it around red circle. (the black thing is camera object)

  • Move camera focus upper (I tried camera.Focus=camera.Focus+Vector3.new(0,5,0),but nothing). [SOLVED by @EgoMoose and me ]

  • Change camera sensitivity via script.

Thx for answering :smile: (I will also be happy, when you say, that some point is impossible, so i know i need to change the game logic in this point)
Edit: I will post video of each problem, but now I don’t have time for it.

3 Likes

To answer the last point, did you assign the Camera.CameraType property to Scriptable?

1 Like
2 Likes

but I need to make it rotateable, so it must be type custom

Any camera type aside from scriptable will not allow custom changes since there are already Default camera scripts (with much HIGHER script privilege than some local script) that override your script.

2 Likes

Ok, so how can I make it doing same as in custom mod, but rotate around upper point?

And is it possible to mouse lock without the mouse lock icon

Just use Player:GetMouse and set the .Icon to whatever you’d like or nil for the default mouse icon.

1 Like

I don’t understand the last two points so maybe you could elaborate on them a bit more?

As for your first question. It is not possible to rotate the camera at 90 degrees given the way Roblox’s core scripts work. You could rewrite the camera yourself to give you a full 360 degrees of rotation, but it’s likely an overkill response depending on what you need.

Could you explain what your intentions are and maybe we can direct you in the right way?

1 Like

point 3 edited, and in point 4 i need to make, that when i have camera focused at some model, it will not rotate around center of its primary part, but it will rotate around vector 10 studs upper, also idk if you underrstood my question 1, so its that i need to set camera rotation limit in up/down axis

Okay well if you want to clamp below 90 degrees you can do that in the player scripts. I think for example in the ClassicCamera module is a constant that lets you set the vertical rotation clamp. But again it can’t be 90 degrees or greater.

Point 3 is not easy. You’re trying to change the zoom controller to be based around an elliptoid, not a sphere. You’ll need to apply some transformation on top of the zoom controller to make this work.

As for your final point, i think this stems from a misunderstanding of what the Focus property is/does and this is quite common because its named awfully.

The Focus property has absolutely nothing to do with how the camera is positioned and rotated. It does NOT define what the camera is looking at like the name implies. It is instead used internally by the engine to decide where to update lighting and shadows. This tends to be the same location as where the camera is physically looking bc you only want to update the lighting and shadows of what’s visible.

I would recommend you either adjust the offset in the core scripts or use a part that’s welded with the offset you want as the camera subject.

3 Likes

lol, sry for bad example

How can i edit the offset in core script?

my common question: How?

Im actually on mobile atm so I can’t tell you line numbers etc, but for all three of your questions you’ll need to get a copy of and modify the Players.SomePlayer.PlayersScripts.PlayerModule core scripts.

As for how you’d modify the zoom controller that’s a really big question that im not personally prepared to answer. I would strongly recommend against not doing it.

3 Likes

As for locking the camera, have you tried making a local script that would take the players rotation into account, and then from that rotation, offset it by -20 or 20, using a clamp? I’m not sure if this would work as an override or not but it’s worth a shot.

I’m not sure of there is a callback that will give you the cameras current angle or not though. Or if that angle is relative to the player or not. All things that would need to be looked into, but I suppose it’s some sort of a start.

1 Like

I think found a link to the source of the lock mouse shift:

1 Like

@return_end1 already solved it
but thx anyway

that is good to know, but when I have the min distance low, camera will go to mesh and that is bad, really bad, extremely bad, and when I have it high, it will be too far from the middle point of the elliptoid, so do I have different option :sad:

Well setting the min distance is an alternative to the zoom controller but it’s the same idea.

In that case you’d need to find the intersection between ellipsoid center and the camera with the ellipsoid surface. Then you could use the magnitude between that intersection and the surface as the min distance.

Again, tmk the math for a ray ellipsoid intersection is a bit messy and heuristic.

2 Likes

And is there some way to auto calculate the distance from surface to subject of camera? And also when I use min distance, I will have problem when I rotate camera from the far from center edge to near to center edge, user will have illusion, that the part is zooming out (just my theory, not tested)

can you tell me, where exactly is the offset, bec i am looking at it and i have no idea
Edit: sry, I found it, it is in PlayerModule.CameraControler.ClassicCamera