CollisionShape3D

继承: Node3D < Node < Object

CollisionObject3D 父级提供 Shape3D 的节点。

描述

A node that provides a Shape3D to a CollisionObject3D parent and allows it to be edited. This can give a detection shape to an Area3D or turn a PhysicsBody3D into a solid object.

Warning: A non-uniformly scaled CollisionShape3D will likely not behave as expected. Make sure to keep its scale the same on all axes and adjust its shape resource instead.

教程

属性

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()

禁用的碰撞形状在世界中没有影响。这个属性应该用 Object.set_deferred() 改变。


Shape3D shape 🔗

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


方法说明

void make_convex_from_siblings() 🔗

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


void resource_changed(resource: Resource) 🔗

已弃用: Use Resource.changed instead.

这个方法什么也不做。