VisualInstance3D

package
v0.0.0-...-fe0704e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2025 License: MIT Imports: 26 Imported by: 0

Documentation

Overview

The VisualInstance3D is used to connect a resource to a visual representation. All visual 3D nodes inherit from the VisualInstance3D. In general, you should not access the VisualInstance3D properties directly as they are accessed and managed by the nodes that inherit from VisualInstance3D. VisualInstance3D is the node representation of the RenderingServer instance.

Index

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 Any

type Any interface {
	gd.IsClass
	AsVisualInstance3D() Instance
}

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this [Extension]See Interface for methods that can be overridden by T.

func (*Extension[T]) AsNode

func (self *Extension[T]) AsNode() Node.Instance

func (*Extension[T]) AsNode3D

func (self *Extension[T]) AsNode3D() Node3D.Instance

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsVisualInstance3D

func (self *Extension[T]) AsVisualInstance3D() Instance

type ID

type ID Object.ID

ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Implementation

type Implementation = implementation

Implementation implements Interface with empty methods.

type Instance

type Instance [1]gdclass.VisualInstance3D

Instance of the class with convieniently typed arguments and results.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AsNode

func (self Instance) AsNode() Node.Instance

func (Instance) AsNode3D

func (self Instance) AsNode3D() Node3D.Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsVisualInstance3D

func (self Instance) AsVisualInstance3D() Instance

func (Instance) GetAabb

func (self Instance) GetAabb() AABB.PositionSize

Returns the AABB.PositionSize (also known as the bounding box) for this VisualInstance3D.

func (Instance) GetBase

func (self Instance) GetBase() RID.VisualInstance

Returns the RID of the resource associated with this VisualInstance3D. For example, if the Node is a MeshInstance3D, this will return the RID of the associated Mesh.

func (Instance) GetInstance

func (self Instance) GetInstance() RID.VisualInstance

Returns the RID of this instance. This RID is the same as the RID returned by RenderingServer.InstanceCreate. This RID is needed if you want to call RenderingServer functions directly on this VisualInstance3D.

func (Instance) GetLayerMaskValue

func (self Instance) GetLayerMaskValue(layer_number int) bool

Returns whether or not the specified layer of the Layers is enabled, given a 'layer_number' between 1 and 20.

func (Instance) ID

func (self Instance) ID() ID

func (Instance) Layers

func (self Instance) Layers() int

The render layer(s) this VisualInstance3D is drawn on.

This object will only be visible for Camera3Ds whose cull mask includes any of the render layers this VisualInstance3D is set to.

For Light3Ds, this can be used to control which VisualInstance3Ds are affected by a specific light. For GPUParticles3D, this can be used to control which particles are effected by a specific attractor. For Decals, this can be used to control which VisualInstance3Ds are affected by a specific decal.

To adjust Layers more easily using a script, use GetLayerMaskValue and SetLayerMaskValue.

Note: VoxelGI, SDFGI and LightmapGI will always take all layers into account to determine what contributes to global illumination. If this is an issue, set GeometryInstance3D.GiMode to [Geometryinstance3d.GiModeDisabled] for meshes and Light3D.LightBakeMode to [Light3d.BakeDisabled] for lights to exclude them from global illumination.

func (Instance) SetBase

func (self Instance) SetBase(base RID.VisualInstance)

Sets the resource that is instantiated by this VisualInstance3D, which changes how the engine handles the VisualInstance3D under the hood. Equivalent to RenderingServer.InstanceSetBase.

func (Instance) SetLayerMaskValue

func (self Instance) SetLayerMaskValue(layer_number int, value bool)

Based on 'value', enables or disables the specified layer in the Layers, given a 'layer_number' between 1 and 20.

func (Instance) SetLayers

func (self Instance) SetLayers(value int)

SetLayers sets the property returned by [GetLayerMask].

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) SetSortingOffset

func (self Instance) SetSortingOffset(value Float.X)

SetSortingOffset sets the property returned by [GetSortingOffset].

func (Instance) SetSortingUseAabbCenter

func (self Instance) SetSortingUseAabbCenter(value bool)

SetSortingUseAabbCenter sets the property returned by [IsSortingUseAabbCenter].

func (Instance) SortingOffset

func (self Instance) SortingOffset() Float.X

The amount by which the depth of this VisualInstance3D will be adjusted when sorting by depth. Uses the same units as the engine (which are typically meters). Adjusting it to a higher value will make the VisualInstance3D reliably draw on top of other VisualInstance3Ds that are otherwise positioned at the same spot. To ensure it always draws on top of other objects around it (not positioned at the same spot), set the value to be greater than the distance between this VisualInstance3D and the other nearby VisualInstance3Ds.

func (Instance) SortingUseAabbCenter

func (self Instance) SortingUseAabbCenter() bool

If true, the object is sorted based on the AABB.PositionSize center. The object will be sorted based on the global position otherwise.

The AABB.PositionSize center based sorting is generally more accurate for 3D models. The position based sorting instead allows to better control the drawing order when working with GPUParticles3D and CPUParticles3D.

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

type Interface

type Interface interface {
	GetAabb() AABB.PositionSize
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL