# Group组件
Group组件用于实体添加组,实体方位信息更新时,同步更新组内实体方位信息.
import { Group } from '@tx3d/core';
// 创建实体
const entity = engine.createEntity();
// 添加Group组件
const group = entity.addComponent(Group);
1
2
3
4
5
6
7
2
3
4
5
6
7
# 属性
🌏 children 子实体Transform,只读。
// 获取所有子实体Transform
const children = group.children;
1
2
2
# 接口
🌏 add 添加一个子实体Transform
// 添加一个子实体Transform
group.add( entity1.transform );
1
2
2
🌏 remove 移除一个子实体Transform
// 移除一个子实体Transform
group.remove( entity1.transform );
1
2
2
🌏 clear 清空子实体Transform
// 清空子实体Transform
group.clear();
1
2
2