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

Function Physics_GetGroup

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

returns the group of a collision object * * Returns the group name of a collision object as a hash. * * @name physics.get_group * @param url [type:string|hash|url] the collision object to return the group of. * @return group [type:hash] hash value of the group. * ```lua * local function check_is_enemy() * local group = physics.get_group("#collisiono

Source from the content-addressed store, hash-verified

1233 * ```
1234 */
1235 static int Physics_GetGroup(lua_State* L)
1236 {
1237 DM_LUA_STACK_CHECK(L, 1);
1238
1239 dmGameObject::HCollection collection = dmGameObject::GetCollection(CheckGoInstance(L));
1240 CollisionComponent* comp = 0x0;
1241 CollisionWorld* comp_world = 0x0;
1242 GetCollisionObject(L, 1, collection, &comp, &comp_world);
1243
1244 dmhash_t group_hash = dmGameSystem::GetCollisionGroup(comp_world, comp);
1245 dmScript::PushHash(L, group_hash);
1246
1247 return 1;
1248 }
1249
1250 /*# updates the mask of a collision object
1251 *

Callers

nothing calls this directly

Calls 5

GetCollectionFunction · 0.85
CheckGoInstanceFunction · 0.85
GetCollisionGroupFunction · 0.85
PushHashFunction · 0.85
GetCollisionObjectFunction · 0.70

Tested by

no test coverage detected