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.

CapsuleShape3D

繼承: Shape3D < Resource < RefCounted < Object

用於物理碰撞的 3D 膠囊形狀。

說明

3D 膠囊形狀,旨在用於物理學。通常用於為 CollisionShape3D 提供形狀。

效能:CapsuleShape3D 可以快速檢查碰撞。比 CylinderShape3D 快,但比 SphereShape3D 和 BoxShape3D 慢。

教學

屬性

float

height

2.0

float

mid_height

float

radius

0.5


屬性說明

float height = 2.0 🔗

  • void set_height(value: float)

  • float get_height()

膠囊體的總高度,包括半球。

注意:膠囊體的 height 必須至少為其 radius 的兩倍。否則,膠囊體將變為球體。如果 height 小於 radius 的兩倍,則屬性將調整為有效值。


float mid_height 🔗

  • void set_mid_height(value: float)

  • float get_mid_height()

膠囊的高度,不包括兩個半球。這是膠囊中間圓柱部分的高度,即兩個半球球心之間的距離。這是對 height 的封裝。


float radius = 0.5 🔗

  • void set_radius(value: float)

  • float get_radius()

膠囊體的半徑。

注意:膠囊體的 radius 不能大於其 height 的一半。否則,膠囊體將變為球體。如果 radius 大於 height 的一半,則屬性將調整為有效值。