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
Properties
Section titled “Properties”| 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.
Lua methods
Section titled “Lua methods”Call them on the node (self.node in its script, or self.node:get_node("path")). Every node also has the Node methods.
StaticBodyNode:connect(event, handler)
Section titled “StaticBodyNode:connect(event, handler)”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)eventStaticBodyNodeEvent|stringhandlerfun(value:any, source: StaticBodyNode)
Returns integer id Connection id for disconnect
StaticBodyNode:get_property(path)
Section titled “StaticBodyNode:get_property(path)”Reads an Inspector property by its path (vectors and colours as tables); “script.
local value = self.node:get_property("debugColor")pathStaticBodyNodeProperty|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.
self.node:set_property("debugColor", "#ff8800")pathStaticBodyNodeProperty|stringvalueanyy?number
In a scene file
Section titled “In a scene file”{ "type": "StaticBodyNode", "name": "StaticPlatform", "position": [ 0, 0 ], "properties": { "debugColor": "#4ade80ff", "oneWay": false }}