Documentation
¶
Overview ¶
Package Camera3D provides methods for working with Camera3D object instances.
Index ¶
- type Advanced
- type Any
- type DopplerTracking
- type Instance
- func (self Instance) AsCamera3D() Instance
- func (self Instance) AsNode() Node.Instance
- func (self Instance) AsNode3D() Node3D.Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) Attributes() [1]gdclass.CameraAttributes
- func (self Instance) ClearCurrent()
- func (self Instance) Compositor() [1]gdclass.Compositor
- func (self Instance) CullMask() int
- func (self Instance) Current() bool
- func (self Instance) DopplerTracking() gdclass.Camera3DDopplerTracking
- func (self Instance) Environment() [1]gdclass.Environment
- func (self Instance) Far() Float.X
- func (self Instance) Fov() Float.X
- func (self Instance) FrustumOffset() Vector2.XY
- func (self Instance) GetCameraProjection() Projection.XYZW
- func (self Instance) GetCameraRid() RID.Camera
- func (self Instance) GetCameraTransform() Transform3D.BasisOrigin
- func (self Instance) GetCullMaskValue(layer_number int) bool
- func (self Instance) GetFrustum() []Plane.NormalD
- func (self Instance) GetPyramidShapeRid() RID.Shape3D
- func (self Instance) HOffset() Float.X
- func (self Instance) IsPositionBehind(world_point Vector3.XYZ) bool
- func (self Instance) IsPositionInFrustum(world_point Vector3.XYZ) bool
- func (self Instance) KeepAspect() gdclass.Camera3DKeepAspect
- func (self Instance) MakeCurrent()
- func (self Instance) Near() Float.X
- func (self Instance) ProjectLocalRayNormal(screen_point Vector2.XY) Vector3.XYZ
- func (self Instance) ProjectPosition(screen_point Vector2.XY, z_depth Float.X) Vector3.XYZ
- func (self Instance) ProjectRayNormal(screen_point Vector2.XY) Vector3.XYZ
- func (self Instance) ProjectRayOrigin(screen_point Vector2.XY) Vector3.XYZ
- func (self Instance) Projection() gdclass.Camera3DProjectionType
- func (self Instance) SetAttributes(value [1]gdclass.CameraAttributes)
- func (self Instance) SetCompositor(value [1]gdclass.Compositor)
- func (self Instance) SetCullMask(value int)
- func (self Instance) SetCullMaskValue(layer_number int, value bool)
- func (self Instance) SetCurrent(value bool)
- func (self Instance) SetDopplerTracking(value gdclass.Camera3DDopplerTracking)
- func (self Instance) SetEnvironment(value [1]gdclass.Environment)
- func (self Instance) SetFar(value Float.X)
- func (self Instance) SetFov(value Float.X)
- func (self Instance) SetFrustum(size Float.X, offset Vector2.XY, z_near Float.X, z_far Float.X)
- func (self Instance) SetFrustumOffset(value Vector2.XY)
- func (self Instance) SetHOffset(value Float.X)
- func (self Instance) SetKeepAspect(value gdclass.Camera3DKeepAspect)
- func (self Instance) SetNear(value Float.X)
- func (self Instance) SetOrthogonal(size Float.X, z_near Float.X, z_far Float.X)
- func (self Instance) SetPerspective(fov Float.X, z_near Float.X, z_far Float.X)
- func (self Instance) SetProjection(value gdclass.Camera3DProjectionType)
- func (self Instance) SetSize(value Float.X)
- func (self Instance) SetVOffset(value Float.X)
- func (self Instance) Size() Float.X
- func (self Instance) UnprojectPosition(world_point Vector3.XYZ) Vector2.XY
- func (self *Instance) UnsafePointer() unsafe.Pointer
- func (self Instance) VOffset() Float.X
- func (self Instance) Virtual(name string) reflect.Value
- type KeepAspect
- type ProjectionType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type DopplerTracking ¶
type DopplerTracking = gdclass.Camera3DDopplerTracking //gd:Camera3D.DopplerTracking
const ( /*Disables [url=https://en.wikipedia.org/wiki/Doppler_effect]Doppler effect[/url] simulation (default).*/ DopplerTrackingDisabled DopplerTracking = 0 /*Simulate [url=https://en.wikipedia.org/wiki/Doppler_effect]Doppler effect[/url] by tracking positions of objects that are changed in [code]_process[/code]. Changes in the relative velocity of this camera compared to those objects affect how audio is perceived (changing the audio's [member AudioStreamPlayer3D.pitch_scale]).*/ DopplerTrackingIdleStep DopplerTracking = 1 /*Simulate [url=https://en.wikipedia.org/wiki/Doppler_effect]Doppler effect[/url] by tracking positions of objects that are changed in [code]_physics_process[/code]. Changes in the relative velocity of this camera compared to those objects affect how audio is perceived (changing the audio's [member AudioStreamPlayer3D.pitch_scale]).*/ DopplerTrackingPhysicsStep DopplerTracking = 2 )
type Instance ¶
[Camera3D] is a special node that displays what is visible from its current location. Cameras register themselves in the nearest [Viewport] node (when ascending the tree). Only one camera can be active per viewport. If no viewport is available ascending the tree, the camera will register in the global viewport. In other words, a camera just provides 3D display capabilities to a [Viewport], and, without one, a scene registered in that [Viewport] (or higher viewports) can't be displayed.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AsCamera3D ¶
func (Instance) Attributes ¶
func (self Instance) Attributes() [1]gdclass.CameraAttributes
func (Instance) ClearCurrent ¶
func (self Instance) ClearCurrent()
If this is the current camera, remove it from being current. If [param enable_next] is [code]true[/code], request to make the next camera current, if any.
func (Instance) Compositor ¶
func (self Instance) Compositor() [1]gdclass.Compositor
func (Instance) DopplerTracking ¶
func (self Instance) DopplerTracking() gdclass.Camera3DDopplerTracking
func (Instance) Environment ¶
func (self Instance) Environment() [1]gdclass.Environment
func (Instance) FrustumOffset ¶
func (Instance) GetCameraProjection ¶
func (self Instance) GetCameraProjection() Projection.XYZW
Returns the projection matrix that this camera uses to render to its associated viewport. The camera must be part of the scene tree to function.
func (Instance) GetCameraRid ¶
Returns the camera's RID from the [RenderingServer].
func (Instance) GetCameraTransform ¶
func (self Instance) GetCameraTransform() Transform3D.BasisOrigin
Returns the transform of the camera plus the vertical ([member v_offset]) and horizontal ([member h_offset]) offsets; and any other adjustments made to the position and orientation of the camera by subclassed cameras such as [XRCamera3D].
func (Instance) GetCullMaskValue ¶
Returns whether or not the specified layer of the [member cull_mask] is enabled, given a [param layer_number] between 1 and 20.
func (Instance) GetFrustum ¶
Returns the camera's frustum planes in world space units as an array of [Plane]s in the following order: near, far, left, top, right, bottom. Not to be confused with [member frustum_offset].
func (Instance) GetPyramidShapeRid ¶
Returns the RID of a pyramid shape encompassing the camera's view frustum, ignoring the camera's near plane. The tip of the pyramid represents the position of the camera.
func (Instance) IsPositionBehind ¶
Returns [code]true[/code] if the given position is behind the camera (the blue part of the linked diagram). [url=https://raw.githubusercontent.com/godotengine/godot-docs/master/img/camera3d_position_frustum.png]See this diagram[/url] for an overview of position query methods. [b]Note:[/b] A position which returns [code]false[/code] may still be outside the camera's field of view.
func (Instance) IsPositionInFrustum ¶
Returns [code]true[/code] if the given position is inside the camera's frustum (the green part of the linked diagram). [url=https://raw.githubusercontent.com/godotengine/godot-docs/master/img/camera3d_position_frustum.png]See this diagram[/url] for an overview of position query methods.
func (Instance) KeepAspect ¶
func (self Instance) KeepAspect() gdclass.Camera3DKeepAspect
func (Instance) MakeCurrent ¶
func (self Instance) MakeCurrent()
Makes this camera the current camera for the [Viewport] (see class description). If the camera node is outside the scene tree, it will attempt to become current once it's added.
func (Instance) ProjectLocalRayNormal ¶
Returns a normal vector from the screen point location directed along the camera. Orthogonal cameras are normalized. Perspective cameras account for perspective, screen width/height, etc.
func (Instance) ProjectPosition ¶
Returns the 3D point in world space that maps to the given 2D coordinate in the [Viewport] rectangle on a plane that is the given [param z_depth] distance into the scene away from the camera.
func (Instance) ProjectRayNormal ¶
Returns a normal vector in world space, that is the result of projecting a point on the [Viewport] rectangle by the inverse camera projection. This is useful for casting rays in the form of (origin, normal) for object intersection or picking.
func (Instance) ProjectRayOrigin ¶
Returns a 3D position in world space, that is the result of projecting a point on the [Viewport] rectangle by the inverse camera projection. This is useful for casting rays in the form of (origin, normal) for object intersection or picking.
func (Instance) Projection ¶
func (self Instance) Projection() gdclass.Camera3DProjectionType
func (Instance) SetAttributes ¶
func (self Instance) SetAttributes(value [1]gdclass.CameraAttributes)
func (Instance) SetCompositor ¶
func (self Instance) SetCompositor(value [1]gdclass.Compositor)
func (Instance) SetCullMask ¶
func (Instance) SetCullMaskValue ¶
Based on [param value], enables or disables the specified layer in the [member cull_mask], given a [param layer_number] between 1 and 20.
func (Instance) SetCurrent ¶
func (Instance) SetDopplerTracking ¶
func (self Instance) SetDopplerTracking(value gdclass.Camera3DDopplerTracking)
func (Instance) SetEnvironment ¶
func (self Instance) SetEnvironment(value [1]gdclass.Environment)
func (Instance) SetFrustum ¶
Sets the camera projection to frustum mode (see [constant PROJECTION_FRUSTUM]), by specifying a [param size], an [param offset], and the [param z_near] and [param z_far] clip planes in world space units. See also [member frustum_offset].
func (Instance) SetFrustumOffset ¶
func (Instance) SetHOffset ¶
func (Instance) SetKeepAspect ¶
func (self Instance) SetKeepAspect(value gdclass.Camera3DKeepAspect)
func (Instance) SetOrthogonal ¶
Sets the camera projection to orthogonal mode (see [constant PROJECTION_ORTHOGONAL]), by specifying a [param size], and the [param z_near] and [param z_far] clip planes in world space units. (As a hint, 2D games often use this projection, with values specified in pixels.)
func (Instance) SetPerspective ¶
Sets the camera projection to perspective mode (see [constant PROJECTION_PERSPECTIVE]), by specifying a [param fov] (field of view) angle in degrees, and the [param z_near] and [param z_far] clip planes in world space units.
func (Instance) SetProjection ¶
func (self Instance) SetProjection(value gdclass.Camera3DProjectionType)
func (Instance) SetVOffset ¶
func (Instance) UnprojectPosition ¶
Returns the 2D coordinate in the [Viewport] rectangle that maps to the given 3D point in world space. [b]Note:[/b] When using this to position GUI elements over a 3D viewport, use [method is_position_behind] to prevent them from appearing if the 3D point is behind the camera: [codeblock] # This code block is part of a script that inherits from Node3D. # `control` is a reference to a node inheriting from Control. control.visible = not get_viewport().get_camera_3d().is_position_behind(global_transform.origin) control.position = get_viewport().get_camera_3d().unproject_position(global_transform.origin) [/codeblock]
func (*Instance) UnsafePointer ¶
type KeepAspect ¶
type KeepAspect = gdclass.Camera3DKeepAspect //gd:Camera3D.KeepAspect
const ( /*Preserves the horizontal aspect ratio; also known as Vert- scaling. This is usually the best option for projects running in portrait mode, as taller aspect ratios will benefit from a wider vertical FOV.*/ KeepWidth KeepAspect = 0 /*Preserves the vertical aspect ratio; also known as Hor+ scaling. This is usually the best option for projects running in landscape mode, as wider aspect ratios will automatically benefit from a wider horizontal FOV.*/ KeepHeight KeepAspect = 1 )
type ProjectionType ¶
type ProjectionType = gdclass.Camera3DProjectionType //gd:Camera3D.ProjectionType
const ( /*Perspective projection. Objects on the screen becomes smaller when they are far away.*/ ProjectionPerspective ProjectionType = 0 /*Orthogonal projection, also known as orthographic projection. Objects remain the same size on the screen no matter how far away they are.*/ ProjectionOrthogonal ProjectionType = 1 /*Frustum projection. This mode allows adjusting [member frustum_offset] to create "tilted frustum" effects.*/ ProjectionFrustum ProjectionType = 2 )