Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

GLTFCamera

继承: Resource < RefCounted < Object

代表 GLTF 相机。

描述

代表基础 GLTF 规格中定义的相机。

教程

属性

float

depth_far

4000.0

float

depth_near

0.05

float

fov

1.309

bool

perspective

true

float

size_mag

0.5

方法

GLTFCamera

from_dictionary ( Dictionary dictionary ) static

GLTFCamera

from_node ( Camera3D camera_node ) static

Dictionary

to_dictionary ( ) const

Camera3D

to_node ( ) const


属性说明

float depth_far = 4000.0

  • void set_depth_far ( float value )

  • float get_depth_far ( )

该相机与远剔除边界的距离,相对于其本地 Z 轴,单位为米。映射到 GLTF 的 zfar 属性。


float depth_near = 0.05

  • void set_depth_near ( float value )

  • float get_depth_near ( )

该相机与近剔除边界的距离,相对于其本地 Z 轴,单位为米。映射到 GLTF 的 znear 属性。


float fov = 1.309

该相机的 FOV。这个类和 GLTF 在定义相机 FOV 时使用的都是弧度,但 Godot 使用的是度。映射到 GLTF 的 yfov 属性。只在透视相机中使用,即 perspective 为 true 时。


bool perspective = true

  • void set_perspective ( bool value )

  • bool get_perspective ( )

该相机是否处于透视模式。如果为 false,则该相机处于正交模式。映射到 GLTF 的相机 type 属性。详情见 Camera3D.projection 及 GLTF 规格。


float size_mag = 0.5

  • void set_size_mag ( float value )

  • float get_size_mag ( )

该相机的大小。这个类和 GLTF 在定义相机大小尺度时使用的都是半径的米数,但 Godot 使用的是直径的米数。映射到 GLTF 的 ymag 属性。只在正交相机中使用,即 perspective 为 false 时。


方法说明

GLTFCamera from_dictionary ( Dictionary dictionary ) static

通过解析给定的 Dictionary 新建 GLTFCamera 实例。


GLTFCamera from_node ( Camera3D camera_node ) static

从给定的 Godot Camera3D 节点新建 GLTFCamera 实例。


Dictionary to_dictionary ( ) const

将这个 GLTFCamera 实例序列化为 Dictionary


Camera3D to_node ( ) const

将这个 GLTFCamera 实例转换为 Godot Camera3D 节点。