CapsuleShape3D

继承: Shape3D < Resource < RefCounted < Object

用于物理碰撞的 3D 胶囊形状。

描述

3D 胶囊形状,旨在用于物理学。通常用于为 CollisionShape3D 提供形状。

性能:CapsuleShape3D 可以快速检查碰撞。比 CylinderShape3D 快,但比 SphereShape3DBoxShape3D 慢。

教程

属性

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 的一半,则属性将调整为有效值。