Skip to content

Search

Dokumentasjon

multimesh2d

Godot's MultiMeshInstance2D: the multimesh asset in source, its mesh drawn flat once per instance in one call, each instance tinted over color. The node…

På denne siden

2d · render · 5 properties · 2D

Godot's MultiMeshInstance2D: the multimesh asset in source, its mesh drawn flat once per instance in one call, each instance tinted over color. The node keeps its own copy of the instances, so a script's edits stay on it; children draw once.

In a scene, multimesh2d is the node key that applies it. A script reaches each property below as a field on node.multimesh2d: reading one asks the running component, and assigning one leaves the rest alone. The whole table is node.multimesh2d.get() and node.multimesh2d.set(table).

Properties

property type default description
color color [1,1,1,1] Tint under every instance's own colour, as channel floats or #rrggbb / #rrggbbaa
material asset · material — The material this draws with; empty takes an inherited material component, else the built-in one
pixels_per_unit float 100 Texture pixels per world unit, for a mesh that carries no UVs of its own At least 0.01.
source asset · multimesh — The multimesh asset: the mesh and the instances it is drawn at
texture asset · texture — Image file, project-relative, or a texture asset; empty draws the colour alone

Asset types this component references: material, multimesh, texture.

Script functions

Methods of node.multimesh2d, the handle a node carrying this component exposes. Every handle also has get(), set(table), patch(table), has() and remove().

From multimesh2d:

method what it does
instance_color(int) -> Color The colour one instance draws in.
instance_count() -> int How many instances the node holds.
instance_custom_data(int) -> Color One instance's four floats of custom data, as a colour.
instance_region(int) -> render::InstanceRegion? The texture rectangle one instance's row names with region_origin and region_size, in pixels, or nil when it names none.
instance_transform(int) -> Transform2d One instance's transform.
instances() -> [render::MultimeshInstance] Every instance as the multimesh asset spells it, so assets.save writes a scripted layout into a file.
set_instance_color(int, Color) The colour one instance draws in.
set_instance_count(int) How many instances the node holds. Those below the count keep where they were; new ones are plain, at the node.
set_instance_custom_data(int, Color) Four floats a material's shader reads for one instance, as a colour.
set_instance_transform(int, Transform2d) Place one instance. A shear is kept, as the instance's basis.
set_instances([render::MultimeshInstance]) Replace every instance with a list in the multimesh asset's shape.
set_visible_instance_count(int) How many instances draw, from the first; -1 draws them all.
visible_instance_count() -> int How many instances draw; -1 is all of them.

Er du sikker?