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

Function Physics_GetMaskBit

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

checks the presense of a group in the mask (maskbit) of a collision object * * Returns true if the specified group is set in the mask of a collision * object, false otherwise. * * @name physics.get_maskbit * @param url [type:string|hash|url] the collision object to check the mask of. * @param group [type:string] the name of the group to check for. * @return

Source from the content-addressed store, hash-verified

1299 * ```
1300 */
1301 static int Physics_GetMaskBit(lua_State* L)
1302 {
1303 DM_LUA_STACK_CHECK(L, 1);
1304
1305 dmGameObject::HCollection collection = dmGameObject::GetCollection(CheckGoInstance(L));
1306 CollisionComponent* comp = 0x0;
1307 CollisionWorld* comp_world = 0x0;
1308 GetCollisionObject(L, 1, collection, &comp, &comp_world);
1309 dmhash_t group_id = dmScript::CheckHashOrString(L, 2);
1310
1311 bool boolvalue;
1312 if (! dmGameSystem::GetCollisionMaskBit(comp_world, comp, group_id, &boolvalue)) {
1313 return luaL_error(L, "Collision group not registered: %s.", dmHashReverseSafe64(group_id));
1314 }
1315 lua_pushboolean(L, (int) boolvalue);
1316 return 1;
1317 }
1318
1319 /*#
1320 * @name physics.SHAPE_TYPE_SPHERE

Callers

nothing calls this directly

Calls 8

GetCollectionFunction · 0.85
CheckGoInstanceFunction · 0.85
CheckHashOrStringFunction · 0.85
GetCollisionMaskBitFunction · 0.85
luaL_errorFunction · 0.85
dmHashReverseSafe64Function · 0.85
lua_pushbooleanFunction · 0.85
GetCollisionObjectFunction · 0.70

Tested by

no test coverage detected