R3d.BoxShape:setHalfExtents

From GiderosMobile
Revision as of 02:35, 19 December 2025 by MoKaLux (talk | contribs) (Created page with "'''Available since:''' Gideros 2019.10<br/> '''Class:''' R3d.BoxShape<br/> === Description === Resizes a collision box shape (fixture). <syntaxhighlight lang="lua"> r3d.B...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Available since: Gideros 2019.10
Class: R3d.BoxShape

Description

Resizes a collision box shape (fixture).

r3d.BoxShape:setHalfExtents(hX,hY,hZ)

Parameters

hX: (number) the new half height of the box on the x axis
hY: (number) the new half height of the box on the y axis
hZ: (number) the new half height of the box on the z axis

Example

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