Table of Contents

Class World2D

Namespace
Godot
Assembly
GodotSharp.dll

Class that has everything pertaining to a 2D world: A physics space, a canvas, and a sound space. 2D nodes register their resources into the current 2D world.

public class World2D : Resource, IDisposable
Inheritance
World2D
Implements
Inherited Members

Constructors

World2D()

public World2D()

Properties

Canvas

The Rid of this world's canvas resource. Used by the RenderingServer for 2D drawing.

public Rid Canvas { get; }

Property Value

Rid

DirectSpaceState

Direct access to the world's physics 2D space state. Used for querying current and potential collisions. When using multi-threaded physics, access is limited to _PhysicsProcess(double) in the main thread.

public PhysicsDirectSpaceState2D DirectSpaceState { get; }

Property Value

PhysicsDirectSpaceState2D

NavigationMap

The Rid of this world's navigation map. Used by the NavigationServer2D.

public Rid NavigationMap { get; }

Property Value

Rid

Space

The Rid of this world's physics space resource. Used by the PhysicsServer2D for 2D physics, treating it as both a space and an area.

public Rid Space { get; }

Property Value

Rid

Methods

HasGodotClassMethod(in godot_string_name)

Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.

protected override bool HasGodotClassMethod(in godot_string_name method)

Parameters

method godot_string_name

Name of the method to check for.

Returns

bool

HasGodotClassSignal(in godot_string_name)

Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.

protected override bool HasGodotClassSignal(in godot_string_name signal)

Parameters

signal godot_string_name

Name of the signal to check for.

Returns

bool

InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)

Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.

protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)

Parameters

method godot_string_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool