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
| 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 | * |
nothing calls this directly
no test coverage detected