Platypus platform collision switch off / on in runtime

Hi Defold funs!

I use the Platypus extension, many thanks for this option!!

I would like switch on / off more platform collision in my game under runtime from Lua if possible. So I don’t know how it is… I think I edit the “platypus.platypus.collisions.groups”… I don’t know it is possible…

Correct. You should be able to change the groups table and add/remove groups at runtime:

self.platypus = platypus.create(config)

-- disable collisions with group "foo"
self.platypus.collisions.groups[hash("foo")] = false

-- enable collisions with group "bar"
self.platypus.collisions.groups[hash("bar")] = true
1 Like

Hi Britzl,

thank You for quick response and help!!
Code is perfect but I can change the booleans variables:

-- when pressed the 1 button this code change the platform physics state
		if self.platypus.collisions.groups[hash("onewayplatform")] > 0 then
			self.temp_is_ceil_coll = self.platypus.collisions.groups[hash("onewayplatform")]
			self.platypus.collisions.groups[hash("onewayplatform")] = 0
		else
			self.platypus.collisions.groups[hash("onewayplatform")] = self.temp_is_ceil_coll
		end