MCPcopy Create free account
hub / github.com/defold/defold / Physics_SetMaskBit

Function Physics_SetMaskBit

engine/gamesys/src/gamesys/scripts/script_physics.cpp:1265–1282  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

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 *

Callers

nothing calls this directly

Calls 8

GetCollectionFunction · 0.85
CheckGoInstanceFunction · 0.85
CheckHashOrStringFunction · 0.85
CheckBooleanFunction · 0.85
SetCollisionMaskBitFunction · 0.85
luaL_errorFunction · 0.85
dmHashReverseSafe64Function · 0.85
GetCollisionObjectFunction · 0.70

Tested by

no test coverage detected