R3d.SphereShape.new: Difference between revisions

From GiderosMobile
m Text replacement - "<source" to "<syntaxhighlight"
m Text replacement - "</source>" to "</syntaxhighlight>"
 
Line 6: Line 6:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
r3d.SphereShape.new(radius)
r3d.SphereShape.new(radius)
</source>
</syntaxhighlight>


=== Parameters ===
=== Parameters ===
Line 20: Line 20:
ballvp.body = world:createBody(ballvp:getMatrix())
ballvp.body = world:createBody(ballvp:getMatrix())
ballvp.body:createFixture(ballobj.shape, nil, 64)
ballvp.body:createFixture(ballobj.shape, nil, 64)
</source>
</syntaxhighlight>


{{R3d.SphereShape}}
{{R3d.SphereShape}}

Latest revision as of 13:32, 13 July 2023

Available since: Gideros 2019.10
Class: R3d.SphereShape

Description

Creates a new collision sphere shape (fixture).

r3d.SphereShape.new(radius)

Parameters

radius: (number) the sphere radius

Example

-- 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)