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

NewSphereShape

api.physics.NewSphereShape(radius)

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

Parameters:

Name
Type
Description

radius

float

The distance between the centre of the sphere and its surface.

Returns:

Type
Description

Shape

A spherical collision boundary.

Example:

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

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

-- This entity will occupy a spherical area, for physics calculations.
PreviousNewBoxShape

Last updated 3 months ago