Skip to content

Static Platform

Static immovable collision body that dynamic bodies collide with; perfect for ground, walls, and terrain.

Type: StaticBodyNode · Category: Physics & Collision · Also found as: staticbody, static_body

Property Type Default Description
debugColor color #4ade80ff Colour of the collider outline drawn with Show Bounds & Colliders (and the game’s debug draw).
oneWay boolean false Jump-through platform: bodies pass from below and land on top.

Plus the common properties every node has.

Call them on the node (self.node in its script, or self.node:get_node("path")). Every node also has the Node methods.

Connects a handler to one of this node’s events: collision_started (Contact with another body began), collision_ended (Contact with another body ended); the tree events; custom ones.

self.node:connect("collision_started", function(value, source) Log.info("collision_started") end)
  • event StaticBodyNodeEvent|string
  • handler fun(value: any, source: StaticBodyNode)

Returns integer id Connection id for disconnect

Reads an Inspector property by its path (vectors and colours as tables); “script.” reads a field of the node’s script.

local value = self.node:get_property("debugColor")
  • path StaticBodyNodeProperty|string

Returns any

StaticBodyNode:set_property(path, value, y)

Section titled “StaticBodyNode:set_property(path, value, y)”

Sets an Inspector property by its path: vectors as {x, y} or x, y; colours as {r, g, b[, a]} 0..1 or “#rrggbb[aa]”; enums by name; “script.” a field of the node’s script.

self.node:set_property("debugColor", "#ff8800")
  • path StaticBodyNodeProperty|string
  • value any
  • y? number
{
"type": "StaticBodyNode",
"name": "StaticPlatform",
"position": [
0,
0
],
"properties": {
"debugColor": "#4ade80ff",
"oneWay": false
}
}