Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

BoxMesh

繼承: PrimitiveMesh < Mesh < Resource < RefCounted < Object

生成軸對齊盒 PrimitiveMesh

說明

生成軸對齊盒 PrimitiveMesh

這個盒子的 UV 佈局是以 3×2 的方式排列的,允許單獨對每個面進行貼圖。要在所有的面上套用相同的紋理,請將材質的 UV 屬性改為 Vector3(3, 2, 1)。這樣做等價於在頂點著色器中新增 UV *= vec2(3.0, 2.0)

注意:當使用很大且有紋理的 BoxMesh 時(例如作為地板),你可能會發現 UV 偶爾抖動的問題,這取決於相機的角度。要解決此問題,請增加 subdivide_depthsubdivide_heightsubdivide_width,直到你不再注意到 UV 抖動。

屬性

Vector3

size

Vector3(1, 1, 1)

int

subdivide_depth

0

int

subdivide_height

0

int

subdivide_width

0


屬性說明

Vector3 size = Vector3(1, 1, 1) 🔗

該盒子的寬度、高度和深度。


int subdivide_depth = 0 🔗

  • void set_subdivide_depth(value: int)

  • int get_subdivide_depth()

沿 Z 軸插入的額外邊緣環的數量。


int subdivide_height = 0 🔗

  • void set_subdivide_height(value: int)

  • int get_subdivide_height()

沿 Y 軸插入的額外邊緣環的數量。


int subdivide_width = 0 🔗

  • void set_subdivide_width(value: int)

  • int get_subdivide_width()

沿 X 軸插入的額外邊緣環的數量。