Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

Shape3D

继承: Resource < RefCounted < Object

派生: BoxShape3D, CapsuleShape3D, ConcavePolygonShape3D, ConvexPolygonShape3D, CylinderShape3D, HeightMapShape3D, SeparationRayShape3D, SphereShape3D, WorldBoundaryShape3D

用于物理碰撞的 3D 形状的抽象基类。

描述

所有 3D 形状的抽象基类,针对物理使用设计。

性能:对图元形状进行碰撞检测很快,尤其是 SphereShape3DConvexPolygonShape3DHeightMapShape3D 较慢,ConcavePolygonShape3D 最慢。

教程

属性

float

custom_solver_bias

0.0

float

margin

0.04

方法

ArrayMesh

get_debug_mesh ( )


属性说明

float custom_solver_bias = 0.0

  • void set_custom_solver_bias ( float value )

  • float get_custom_solver_bias ( )

该形状的的自定义求解器偏差。定义了强制接触分离涉及到这个形状时,物体会做出多大的反应。

设为 0.0 时,使用的默认值为 ProjectSettings.physics/3d/solver/default_contact_bias


float margin = 0.04

  • void set_margin ( float value )

  • float get_margin ( )

该形状的碰撞边距。Godot Physics 中未使用。

碰撞边距允许通过在形状周围添加额外的外壳来使碰撞检测更有效。当物体重叠的部分超过其边距时,碰撞算法的成本会更高,所以边距的数值越高对性能越好,但代价是边缘的精度会降低,因为会让边缘的锐度降低。


方法说明

ArrayMesh get_debug_mesh ( )

返回用于绘制此 Shape3D 的调试碰撞的 ArrayMesh