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.

ConvexPolygonShape3D

繼承: Shape3D < Resource < RefCounted < Object

用於物理碰撞的 3D 凸多面體形狀。

說明

3D 凸多面體形狀,旨在用於物理。常用來為 CollisionShape3D 提供形狀。

ConvexPolygonShape3D實心的,與空心的 ConcavePolygonShape3D 不同,如果物件完全位於其內部,也能夠偵測到碰撞。因此更適於偵測和物理。

凸分解:凹多面體可以拆分為多個凸多面體。這樣就能夠讓動態物理體擁有複雜的凹碰撞(以消耗性能為代價),做法是使用多個 ConvexPolygonShape3D 節點。要根據網格生成凸分解,請選中 MeshInstance3D 節點,前往出現在視口上方的 Mesh 功能表,然後選擇建立多個凸碰撞同級。或者也可以在腳本中呼叫 MeshInstance3D.create_multiple_convex_collisions(),在運作時執行分解。

性能:ConvexPolygonShape3D 檢查碰撞的速度比 ConcavePolygonShape3D 要快,但比 SphereShape3DBoxShape3D 等基本碰撞形狀要慢。通常應該僅限於中等大小的物件,在無法使用基本形狀精確表示碰撞時使用。

教學

屬性

PackedVector3Array

points

PackedVector3Array()


屬性說明

PackedVector3Array points = PackedVector3Array() 🔗

形成凸多邊形的 3D 點列表。

Note: The returned array is copied and any changes to it will not update the original property value. See PackedVector3Array for more details.