R3d.BoxShape.new

From GiderosMobile
Revision as of 14:31, 13 July 2023 by Hgy29 (talk | contribs) (Text replacement - "</source>" to "</syntaxhighlight>")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Available since: Gideros 2019.10
Class: R3d.BoxShape

Description

Creates a new collision box shape (fixture).

r3d.BoxShape.new(hX,hY,hZ)

Parameters

hX: (number) the half height of the box on the X axis
hY: (number) the half height of the box on the Y axis
hZ: (number) the half height of the box on the Z axis

Example

-- a ship
local shipobj = loadObj("3d/ship", "ship.obj")
shipobj.shape1 = r3d.BoxShape.new(4, 2, 6)
shipobj.mass = 128
local shipvp = Viewport.new()
shipvp:setContent(shipobj)
shipvp.body = world:createBody(shipvp:getMatrix())
shipvp.body:createFixture(shipobj.shape1, nil, shipobj.mass)