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.

CollisionShape3D

继承: Node3D < Node < Object

CollisionObject3D 父级提供 Shape3D 的节点。

描述

CollisionObject3D 父级提供 Shape3D 并能够对其进行编辑的节点。可以为 Area3D 提供检测形状,也可以将 PhysicsBody3D 变为实体对象。

警告:非均匀缩放的 CollisionShape3D 可能无法按预期运行。请保持在所有轴上使用相同的缩放,需要时可以更改其 shape 资源代替。

教程

属性

Color

debug_color

Color(0, 0, 0, 0)

bool

debug_fill

true

bool

disabled

false

Shape3D

shape

方法

void

make_convex_from_siblings()

void

resource_changed(resource: Resource)


属性说明

Color debug_color = Color(0, 0, 0, 0) 🔗

  • void set_debug_color(value: Color)

  • Color get_debug_color()

碰撞形状的颜色,在编辑器中显示,勾选编辑器顶部的 调试 > 显示碰撞形状 时也会在运行项目时显示。

注意:默认值为 ProjectSettings.debug/shapes/collision/shape_color。这里记录的 Color(0, 0, 0, 0) 值是占位符,不是实际的默认调试颜色。


bool debug_fill = true 🔗

  • void set_enable_debug_fill(value: bool)

  • bool get_enable_debug_fill()

如果为 true,则显示形状时除了显示线框外还会显示填充颜色。


bool disabled = false 🔗

  • void set_disabled(value: bool)

  • bool is_disabled()

禁用的碰撞形状对世界没有任何影响。


Shape3D shape 🔗

该碰撞形状拥有的实际形状。


方法说明

void make_convex_from_siblings() 🔗

将碰撞形状的形状设置为其所有凸面 MeshInstance3D 同级几何体的相加。


void resource_changed(resource: Resource) 🔗

已弃用: Use Resource.changed instead.

这个方法什么也不做。