Inheritance #
- AudioServer
- CameraServer
- ClassDB
- DisplayServer
- EditorFileSystemDirectory
- EditorInterface
- EditorPaths
- EditorSelection
- EditorUndoRedoManager
- EditorVCSInterface
- Engine
- EngineDebugger
- FramebufferCacheRD
- GDExtensionManager
- Geometry2D
- Geometry3D
- IP
- Input
- InputMap
- JNISingleton
- JSONRPC
- JavaClassWrapper
- JavaScriptBridge
- MainLoop (1)
- Marshalls
- MovieWriter
- NativeMenu
- NavigationMeshGenerator
- NavigationServer2D
- NavigationServer3D
- Node (21)
- OS
- OpenXRExtensionWrapperExtension
- OpenXRInteractionProfileMetadata
- Performance
- PhysicsDirectBodyState2D (1)
- PhysicsDirectBodyState3D (1)
- PhysicsDirectSpaceState2D (1)
- PhysicsDirectSpaceState3D (1)
- PhysicsServer2D (1)
- PhysicsServer2DManager
- PhysicsServer3D (1)
- PhysicsServer3DManager
- PhysicsServer3DRendering
ServerHandler
- ProjectSettings
- RefCounted (121)
- RenderData (2)
- RenderSceneData (2)
- RenderingDevice
- RenderingServer
- ResourceLoader
- ResourceSaver
- ResourceUID
- ScriptLanguage (1)
- ShaderIncludeDB
- TextServerManager
- ThemeDB
- TileData
- Time
- TranslationServer
- TreeItem
- UndoRedo
- UniformSetCacheRD
- WorkerThreadPool
- XRServer
- XRVRS
- AnimationMixer (2)
- AudioStreamPlayer
- CanvasItem (2)
- CanvasLayer (1)
- EditorFileSystem
- EditorPlugin (1)
- EditorResourcePreview
- HTTPRequest
- InstancePlaceholder
- MissingNode
- MultiplayerSpawner
- MultiplayerSynchronizer
- NavigationAgent2D
- NavigationAgent3D
- Node3D (31)
- ResourcePreloader
- ShaderGlobalsOverride
- StatusIndicator
- Timer
- Viewport (2)
- WorldEnvironment
- AnimatedSprite2D
- AudioListener2D
- AudioStreamPlayer2D
- BackBufferCopy
- Bone2D
- CPUParticles2D
- Camera2D
- CanvasGroup
- CanvasModulate
- CollisionObject2D (2)
- CollisionPolygon2D
- CollisionShape2D
- GPUParticles2D
- Joint2D (3)
- Light2D (2)
- LightOccluder2D
- Line2D
- Marker2D
- MeshInstance2D
- MultiMeshInstance2D
- NavigationLink2D
- NavigationObstacle2D
- NavigationRegion2D
- Parallax2D
- ParallaxLayer
- Path2D
- PathFollow2D
- Polygon2D
- RayCast2D
- RemoteTransform2D
- ShapeCast2D
- Skeleton2D
- Sprite2D
- TileMap
- TileMapLayer
- TouchScreenButton
- VisibleOnScreenNotifier2D (1)
Table of contents
CollisionPolygon2D #
is_instantiable, Node2D, Node, core, not_builtin_classes
A node that provides a polygon shape to a CollisionObject2D parent.
A node that provides a polygon shape to a CollisionObject2D parent and allows to edit it. The polygon can be concave or convex. This can give a detection shape to an Area2D, turn PhysicsBody2D into a solid object, or give a hollow shape to a StaticBody2D.
Warning: A non-uniformly scaled CollisionPolygon2D will likely not behave as expected. Make sure to keep its scale the same on all axes and adjust its polygon instead.
Members #
var build_mode = BUILD_SOLIDS#
Collision build mode. Use one of the BuildMode constants.
var disabled: bool = false#
If true, no collisions will be detected.
var one_way_collision: bool = false#
If true, only edges that face up, relative to CollisionPolygon2D's rotation, will collide with other objects.
Note: This property has no effect if this CollisionPolygon2D is a child of an Area2D node.
var one_way_collision_margin: float = 1.0#
The margin used for one-way collision (in pixels). Higher values will make the shape thicker, and work better for colliders that enter the polygon at a high velocity.
var polygon: PackedVector2Array = PackedVector2Array()#
The polygon's list of vertices. Each point will be connected to the next, and the final point will be connected to the first.
Note: The returned vertices are in the local coordinate space of the given CollisionPolygon2D.
Methods #
Annotations #
Constants #
const BUILD_SOLIDS = 0 enum BuildMode#
Collisions will include the polygon and its contained area. In this mode the node has the same effect as several ConvexPolygonShape2D nodes, one for each convex shape in the convex decomposition of the polygon (but without the overhead of multiple nodes).
const BUILD_SEGMENTS = 1 enum BuildMode#
Collisions will only include the polygon edges. In this mode the node has the same effect as a single ConcavePolygonShape2D made of segments, with the restriction that each segment (after the first one) starts where the previous one ends, and the last one ends where the first one starts (forming a closed but hollow polygon).
Constructors #
Enums #
BuildMode#
enum BuildMode {
BUILD_SOLIDS = 0,
BUILD_SEGMENTS = 1,
}