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

Function Physics_SetGroup

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

change the group of a collision object * * Updates the group property of a collision object to the specified * string value. The group name should exist i.e. have been used in * a collision object in the editor. * * @name physics.set_group * @param url [type:string|hash|url] the collision object affected. * @param group [type:string] the new group name to be

Source from the content-addressed store, hash-verified

1202 * ```
1203 */
1204 static int Physics_SetGroup(lua_State* L)
1205 {
1206 DM_LUA_STACK_CHECK(L, 0);
1207
1208 dmGameObject::HCollection collection = dmGameObject::GetCollection(CheckGoInstance(L));
1209 CollisionComponent* comp = 0x0;
1210 CollisionWorld* comp_world = 0x0;
1211 GetCollisionObject(L, 1, collection, &comp, &comp_world);
1212 dmhash_t group_id = dmScript::CheckHashOrString(L, 2);
1213
1214 if (! dmGameSystem::SetCollisionGroup(comp_world, comp, group_id)) {
1215 return luaL_error(L, "Collision group not registered: %s.", dmHashReverseSafe64(group_id));
1216 }
1217
1218 return 0;
1219 }
1220
1221 /*# returns the group of a collision object
1222 *

Callers

nothing calls this directly

Calls 7

GetCollectionFunction · 0.85
CheckGoInstanceFunction · 0.85
CheckHashOrStringFunction · 0.85
SetCollisionGroupFunction · 0.85
luaL_errorFunction · 0.85
dmHashReverseSafe64Function · 0.85
GetCollisionObjectFunction · 0.70

Tested by

no test coverage detected