Skip to content

🏷️碰撞体信息获取能力

tongsim.entity.ability.impl.collision_shape

tongsim.entity.ability.impl.collision

CollisionShapeAbility

Bases: Protocol

提供对象的碰撞体信息的获取接口。

Source code in src\tongsim\entity\ability\impl\collision_shape.py
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
class CollisionShapeAbility(Protocol):
    """
    提供对象的碰撞体信息的获取接口。
    """

    def get_relative_aabb(self) -> Box:
        """
        获取对象的相对 Box(同步接口)。

        注意:
            返回的 Box 是**相对于物体位置(location)**的本地包围盒。(默认 Scale 为 1)

        Returns:
            Box: 相对 Box(本地坐标系下)
        """

    async def async_get_relative_aabb(self) -> Box:
        """
        获取对象的相对 Box(异步接口)。

        注意:
            返回的 Box 是**相对于物体位置(location)**的本地包围盒。(默认 Scale 为 1)

        Returns:
            Box: 相对 Box(本地坐标系下)
        """

    def get_world_aabb(self) -> Box:
        """
        获取物体的世界空间 Box(同步接口)。

        Returns:
            Box: 绝对 Box(世界坐标系下)
        """

    async def async_get_world_aabb(self) -> Box:
        """
        获取物体的世界空间 Box(异步接口)。

        Returns:
            Box: 绝对 Box(世界坐标系下)
        """

get_relative_aabb

get_relative_aabb() -> Box

获取对象的相对 Box(同步接口)。

注意: 返回的 Box 是相对于物体位置(location)的本地包围盒。(默认 Scale 为 1)

Returns:

Name Type Description
Box Box

相对 Box(本地坐标系下)

Source code in src\tongsim\entity\ability\impl\collision_shape.py
24
25
26
27
28
29
30
31
32
33
def get_relative_aabb(self) -> Box:
    """
    获取对象的相对 Box(同步接口)。

    注意:
        返回的 Box 是**相对于物体位置(location)**的本地包围盒。(默认 Scale 为 1)

    Returns:
        Box: 相对 Box(本地坐标系下)
    """

async_get_relative_aabb async

async_get_relative_aabb() -> Box

获取对象的相对 Box(异步接口)。

注意: 返回的 Box 是相对于物体位置(location)的本地包围盒。(默认 Scale 为 1)

Returns:

Name Type Description
Box Box

相对 Box(本地坐标系下)

Source code in src\tongsim\entity\ability\impl\collision_shape.py
35
36
37
38
39
40
41
42
43
44
async def async_get_relative_aabb(self) -> Box:
    """
    获取对象的相对 Box(异步接口)。

    注意:
        返回的 Box 是**相对于物体位置(location)**的本地包围盒。(默认 Scale 为 1)

    Returns:
        Box: 相对 Box(本地坐标系下)
    """

get_world_aabb

get_world_aabb() -> Box

获取物体的世界空间 Box(同步接口)。

Returns:

Name Type Description
Box Box

绝对 Box(世界坐标系下)

Source code in src\tongsim\entity\ability\impl\collision_shape.py
46
47
48
49
50
51
52
def get_world_aabb(self) -> Box:
    """
    获取物体的世界空间 Box(同步接口)。

    Returns:
        Box: 绝对 Box(世界坐标系下)
    """

async_get_world_aabb async

async_get_world_aabb() -> Box

获取物体的世界空间 Box(异步接口)。

Returns:

Name Type Description
Box Box

绝对 Box(世界坐标系下)

Source code in src\tongsim\entity\ability\impl\collision_shape.py
54
55
56
57
58
59
60
async def async_get_world_aabb(self) -> Box:
    """
    获取物体的世界空间 Box(异步接口)。

    Returns:
        Box: 绝对 Box(世界坐标系下)
    """