#Godot 4.1.3 Collision2d set_collision_layer_value()

14 messages · Page 1 of 1 (latest)

pliant trench
#

I'm following an old tutorial to learn multiple Godot systems at once, but they were using Collision2D's set_collision_layer_bit(). That doesn't appear to exist anymore and it recommended I use set_collision_layer_value() but I'm unsure which value to use. Each layer has 3 different numbers associated with it.

honest gulch
#

That's the documentation I'm seeing in the editor for CollisionObject2D. So you should be able to do something like
object.set_collision_layer_value(1,true)

#

Where "1" is what layer you want to enable/disable, and "true" being whether you want it enabled or disabled

pliant trench
#

So just a random example would be obj.set_collision_layer_value(5,false) instead of the layer's value attribute?

honest gulch
#

Actually. i dont know

#

try both of them and check the values in the inspector at runtime

pliant trench
#

Is that the debugger behind the game popup?

#

Nvm i know what you mean, i didnt know that updated in real time with the scene running

honest gulch
#

#programming message

pliant trench
#

5 Appears to work from a visual examination (in game), 16 doesn't appear to work at all and neither updates the inspector when running the game

honest gulch
#

I'm sure 16 does something, because you're supposed to be able to use values between 1 & 32