Camera

显示已弃用

*此内容使用人工智能(Beta)翻译,可能包含错误。若要查看英文页面,请点按 此处

未复制

Camera 对象定义了 3D 世界的视图。在运行中的体验中,每个客户端都有自己的 Camera 对象,它位于该客户端的本地 Workspace 中,可通过 Workspace.CurrentCamera 属性访问。

最重要的相机属性是:

  • CFrame 代表相镜头的位置和方向。

  • CameraType 这是被体验的相机脚本阅读的,决定相机应如何在每帧更新。

  • CameraSubject 这是被体验的相机脚本阅读的,决定相机应该跟关注的对象。

  • FieldOfView 表示可观察世界的可见范围。

  • Focus 代表相机正在观察的点。设置此属性很重要,因为某些视觉效果会更详细,并且更频繁地更新,取决于它们与焦点的距离有多近。

请参阅自定义相机以获取更多关于如何调整和自定义相镜头行为的信息。

存储多个相机

请注意,当将 Workspace.CurrentCamera 更改为新的 Camera 时,所有其他 Cameras 都会直接从 Workspace 降级。如果您需要存储多个相机并在需要时间切换之间使用它们,建议将它们存储在 或 下的 中,在其更改时仍然保持不变。

概要

属性

继承自PVInstance属性

属性

方法

继承自PVInstance方法

方法

  • 写入并联

    获取 PVInstance 的枢轴。

  • PivotTo(targetCFrame : CFrame):()

    将 以及所有其子孙 转换为位于指定 的位置,使旋转点现在位于指定的 。

属性

CFrame

读取并联

CameraSubject

读取并联

CameraType

读取并联

DiagonalFieldOfView

未复制
读取并联

FieldOfView

读取并联

FieldOfViewMode

读取并联

Focus

读取并联

HeadLocked

读取并联

HeadScale

读取并联

MaxAxisFieldOfView

未复制
读取并联

NearPlaneZ

只读
未复制
读取并联

VRTiltAndRollEnabled

读取并联

ViewportSize

只读
未复制
读取并联

方法

GetPartsObscuringTarget

Instances

参数

castPoints: Array
默认值:""
ignoreList: Instances
默认值:""

返回

Instances

GetRenderCFrame


返回

GetRoll


返回

代码示例

相机:获取滚动

local currentRoll = math.deg(workspace.CurrentCamera:GetRoll()) -- 获取相机的当前卷在度数。
if currentRoll ~= 20 then
workspace.CurrentCamera:SetRoll(math.rad(20)) -- 如果相机不在 20 度滚动角度,滚动将设置为 20 度。
end

ScreenPointToRay

写入并联

参数

默认值:""
默认值:""
depth: number
默认值:0

返回

SetRoll

()

参数

rollAngle: number
默认值:""

返回

()

ViewportPointToRay

写入并联

参数

默认值:""
默认值:""
depth: number
默认值:0

返回

WorldToScreenPoint

写入并联

参数

worldPoint: Vector3
默认值:""

返回

WorldToViewportPoint

写入并联

参数

worldPoint: Vector3
默认值:""

返回

ZoomToExtents

()

参数

boundingBoxCFrame: CFrame
默认值:""
boundingBoxSize: Vector3
默认值:""

返回

()

活动

InterpolationFinished