updates the mask of a collision object * * Sets or clears the masking of a group (maskbit) in a collision object. * * @name physics.set_maskbit * @param url [type:string|hash|url] the collision object to change the mask of. * @param group [type:string] the name of the group (maskbit) to modify in the mask. * @param maskbit [type:boolean] boolean value of the new
| 1263 | * ``` |
| 1264 | */ |
| 1265 | static int Physics_SetMaskBit(lua_State* L) |
| 1266 | { |
| 1267 | DM_LUA_STACK_CHECK(L, 0); |
| 1268 | |
| 1269 | dmGameObject::HCollection collection = dmGameObject::GetCollection(CheckGoInstance(L)); |
| 1270 | |
| 1271 | CollisionComponent* comp = 0x0; |
| 1272 | CollisionWorld* comp_world = 0x0; |
| 1273 | GetCollisionObject(L, 1, collection, &comp, &comp_world); |
| 1274 | dmhash_t group_id = dmScript::CheckHashOrString(L, 2); |
| 1275 | bool boolvalue = dmScript::CheckBoolean(L, 3); |
| 1276 | |
| 1277 | if (! dmGameSystem::SetCollisionMaskBit(comp_world, comp, group_id, boolvalue)) { |
| 1278 | return luaL_error(L, "Collision group not registered: %s.", dmHashReverseSafe64(group_id)); |
| 1279 | } |
| 1280 | |
| 1281 | return 0; |
| 1282 | } |
| 1283 | |
| 1284 | /*# checks the presense of a group in the mask (maskbit) of a collision object |
| 1285 | * |
nothing calls this directly
no test coverage detected