Character Body

self:set_dimension

Shared

Sets the dimension of the character 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

TypeNameDescription
intdimensionDimension id to apply
Must be within 0 to 65535

Returns

TypeNameDescription
boolstatustrue on successful execution, false otherwise

Examples

Set the dimension of a character body
local entity = physics.character.create()

entity:set_dimension(1)

On this page