GE Lua Documentation

Press F to search!

prefabIsChildOfGroup

Definition


-- @/lua/ge/ge_utils.lua:381


-- helper function that can determine if an object is part of a simgroup
function prefabIsChildOfGroup(obj, groupName)
  if not obj then
    return false
  end

  local group = scenetree.findObject(groupName)
  if not group then
    return false
  end

  if obj:isChildOfGroup(group.obj) then
    return true
  end

  local parentPrefab = Prefab.getPrefabByChild( obj )
  if parentPrefab and parentPrefab:isChildOfGroup(group.obj) then
    return true
  end
  return false
end

Callers

@/lua/ge/extensions/scenario/scenarios.lua
    local to = scenetree.findObject(vecName)
    if to and to.obj and to.obj:getId() and prefabIsChildOfGroup(to.obj, 'ScenarioObjectsGroup') then
      to = Sim.upcast(to)