LogoLogo
  • Introduction
  • sdks
    • Feature Comparison
    • Unity
    • Godot
    • Defold
    • LÖVE
    • Unreal
  • Quick Start
    • Unity
    • Godot
    • Defold
    • LÖVE
    • Unreal
  • Server Side
    • Entities
    • Chunks
    • Dimensions
    • Events
    • Logging
    • Lua Environment
    • Git Primer
    • Physics
  • HTTP API
    • Authentication
    • Player API
  • Api Reference
    • Entity API
      • Create
      • Message
    • Client API
      • Message
    • Dimension API
      • Create
      • Delete
      • List
    • Events API
      • on_player_join
      • on_player_leave
    • Table API
      • Append
      • Remove
      • Join
    • Util API
      • Time
      • TimeMillis
    • HTTP Request API
      • Get
      • Post
      • Put
      • Delete
    • Physics API
      • NewBody
      • NewBoxShape
      • NewSphereShape
Powered by GitBook
On this page
  1. Api Reference
  2. Physics API

NewBoxShape

api.physics.NewBoxShape(width, length, depth)

Creates a new box shape, to act as collision boundaries.

Parameters:

Name
Type
Description

width

float

The world measurement of the box along the X axis.

length

float

The world measurement of the box along the Y axis.

depth

float

The world measurement of the box along the Z axis.

Returns:

Type
Description

Shape

A box-shaped collision boundary.

Example:

Create a physics body with collision boundaries in the shape of a box, and assigns it to this entity.

-- entity_type_name.lua
local function init(self)
    self.Physics = true
    
    local box = api.physics.NewBoxShape(1, 1, 1) 
    self.Body = api.physics.NewBody(box, 10)
end

-- This entity will occupy a box-shaped area, for physics calculations.
PreviousNewBodyNextNewSphereShape

Last updated 3 months ago