R3d.BoxShape:setHalfExtents
From GiderosMobile
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)