Difference between revisions of "R3d.SphereShape.new"

From GiderosMobile
(Created page with "'''Available since:''' Gideros 2019.10<br/> '''Class:''' R3d.SphereShape<br/> === Description === Creates a new collision sphere shape (fixture). <source lang="lua"> r3d....")
 
m (Text replacement - "<source" to "<syntaxhighlight")
Line 4: Line 4:
 
=== Description ===
 
=== Description ===
 
Creates a new collision sphere shape (fixture).
 
Creates a new collision sphere shape (fixture).
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
r3d.SphereShape.new(radius)
 
r3d.SphereShape.new(radius)
 
</source>
 
</source>
Line 12: Line 12:
  
 
=== Example ===
 
=== Example ===
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
-- a ball
 
-- a ball
 
local ballobj = loadObj("3d/balls", "ball.obj")
 
local ballobj = loadObj("3d/balls", "ball.obj")

Revision as of 15:30, 13 July 2023

Available since: Gideros 2019.10
Class: R3d.SphereShape

Description

Creates a new collision sphere shape (fixture). <syntaxhighlight lang="lua"> r3d.SphereShape.new(radius) </source>

Parameters

radius: (number) the sphere radius

Example

<syntaxhighlight lang="lua"> -- a ball local ballobj = loadObj("3d/balls", "ball.obj") ballobj.shape = r3d.SphereShape.new(3) local ballvp = Viewport.new() ballvp:setContent(ballobj) ballvp.body = world:createBody(ballvp:getMatrix()) ballvp.body:createFixture(ballobj.shape, nil, 64) </source>