Class VisualInstance3D
- Namespace
- Godot
- Assembly
- GodotSharp.dll
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.
public class VisualInstance3D : Node3D, IDisposable
- Inheritance
-
VisualInstance3D
- Implements
- Derived
- Inherited Members
Constructors
VisualInstance3D()
public VisualInstance3D()
Properties
Layers
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(int) and SetLayerMaskValue(int, bool).
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 GIMode to Disabled for meshes and LightBakeMode to Disabled for lights to exclude them from global illumination.
public uint Layers { get; set; }
Property Value
SortingOffset
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.
public float SortingOffset { get; set; }
Property Value
SortingUseAabbCenter
If true
, the object is sorted based on the Aabb center. The object will be sorted based on the global position otherwise.
The Aabb 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.
public bool SortingUseAabbCenter { get; set; }
Property Value
Methods
GetAabb()
Returns the Aabb (also known as the bounding box) for this VisualInstance3D.
public Aabb GetAabb()
Returns
GetBase()
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.
public Rid GetBase()
Returns
GetInstance()
Returns the RID of this instance. This RID is the same as the RID returned by InstanceCreate(). This RID is needed if you want to call RenderingServer functions directly on this VisualInstance3D.
public Rid GetInstance()
Returns
GetLayerMaskValue(int)
Returns whether or not the specified layer of the Layers is enabled, given a layerNumber
between 1 and 20.
public bool GetLayerMaskValue(int layerNumber)
Parameters
layerNumber
int
Returns
HasGodotClassMethod(in godot_string_name)
Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.
protected override bool HasGodotClassMethod(in godot_string_name method)
Parameters
method
godot_string_nameName of the method to check for.
Returns
HasGodotClassSignal(in godot_string_name)
Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.
protected override bool HasGodotClassSignal(in godot_string_name signal)
Parameters
signal
godot_string_nameName of the signal to check for.
Returns
InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)
Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.
protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)
Parameters
method
godot_string_nameName of the method to invoke.
args
NativeVariantPtrArgsArguments to use with the invoked method.
ret
godot_variantValue returned by the invoked method.
Returns
SetBase(Rid)
Sets the resource that is instantiated by this VisualInstance3D, which changes how the engine handles the VisualInstance3D under the hood. Equivalent to InstanceSetBase(Rid, Rid).
public void SetBase(Rid @base)
Parameters
base
Rid
SetLayerMaskValue(int, bool)
Based on value
, enables or disables the specified layer in the Layers, given a layerNumber
between 1 and 20.
public void SetLayerMaskValue(int layerNumber, bool value)
Parameters
_GetAabb()
public virtual Aabb _GetAabb()