R3d.Fixture:setIsTrigger
From GiderosMobile
Revision as of 02:21, 19 December 2025 by MoKaLux (talk | contribs) (Created page with "__NOTOC__ '''Available since:''' Gideros 2019.10<br/> '''Class:''' R3d.Fixture<br/> === Description === Sets a collider (fixture) as trigger. <syntaxhighlight lang="lua">...")
Available since: Gideros 2019.10
Class: R3d.Fixture
Description
Sets a collider (fixture) as trigger.
r3d.Fixture:setIsTrigger(trigger)
Triggers
It is possible to set a collider as being a trigger. You can do this if you do not want any collision with this collider but you are only interested in knowing when another collider enters or exit the volume of the collider.
Parameters
trigger: (bool) whether the fixture is a trigger or not
Example
-- r3d body
viewport.body = world:createBody(matrix)
viewport.body:setType(params.type)
viewport.body.id = "player1"
local shape1 = r3d.SphereShape.new(h/4)
local shape2 = r3d.SphereShape.new(h/4)
local t1, t2 = Matrix.new(), Matrix.new()
t1:setPosition(0, h/4/2, -d/2)
t2:setPosition(0, h/4/2, d/2)
local f1 = viewport.body:createFixture(shape1, t1, 1) -- shape, transform, mass
local f2 = viewport.body:createFixture(shape2, t2, 1) -- shape, transform, mass
f2:setIsTrigger(true)