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.
Checking the stable version of the documentation...
World2D
继承: Resource < RefCounted < Object
一种保存了所有 2D 世界组件的资源,例如画布和物理运算空间。
描述
这个类包含所有与 2D 世界相关的内容:物理空间、可视场景和音频空间。2D 节点会将它们的资源注册到当前的 2D 世界中。
教程
属性
属性说明
RID get_canvas()
这个世界的画布资源的 RID。由 RenderingServer 用于 2D 绘制。
PhysicsDirectSpaceState2D direct_space_state 🔗
PhysicsDirectSpaceState2D get_direct_space_state()
直接访问该世界的物理 2D 空间状态。可用于查询当前和可能的碰撞。在多线程物理中使用时,仅可在主线程的 Node._physics_process() 中访问。
RID get_navigation_map()
这个世界的导航地图的 RID。由 NavigationServer2D 使用。
RID get_space()
这个世界物理空间资源的 RID。由 PhysicsServer2D 用于 2D 物理,将其视为一个空间和一个区域。