Static Body
self:set_dimension
SharedSets the dimension of the static body
Syntax
local status = self:set_dimension(
dimension
)Dimensions are fully isolated from each other.
- Rendering — the client only shows entities that match the dimension of its active camera.
- Physics — bodies and areas only collide with, trigger, and get hit by queries of the same dimension.
- Hierarchy — the dimension applies to the entity and all of its children.
- Attached — an entity parented to another entity always follows its parent's dimension and cannot set its own, the call raises an error. Detaching it keeps the dimension it had.
Dimension changes on network-synced entities are restricted to their owner.
- On the server — the new dimension is replicated to all clients.
- On the client — only the peer holding sync authority can change the entity, the change is sent to the server and relayed to the other peers. Any other call raises an error.
Parameters
| Type | Name | Description |
|---|---|---|
int | dimension | Dimension id to apply Must be within 0 to 65535 |
Returns
| Type | Name | Description |
|---|---|---|
bool | status | true on successful execution, false otherwise |
Examples
local entity = physics.static.create()
entity:set_dimension(1)