Shape2D
Inherits: Resource < Reference < Object
Inherited By: CapsuleShape2D, CircleShape2D, ConcavePolygonShape2D, ConvexPolygonShape2D, LineShape2D, RayShape2D, RectangleShape2D, SegmentShape2D
所有2D形状的基类。
描述
所有2D形状的基类。所有的2D形状类型都继承于此。
教程
属性
|
方法
collide ( Transform2D local_xform, Shape2D with_shape, Transform2D shape_xform ) | |
collide_and_get_contacts ( Transform2D local_xform, Shape2D with_shape, Transform2D shape_xform ) | |
collide_with_motion ( Transform2D local_xform, Vector2 local_motion, Shape2D with_shape, Transform2D shape_xform, Vector2 shape_motion ) | |
collide_with_motion_and_get_contacts ( Transform2D local_xform, Vector2 local_motion, Shape2D with_shape, Transform2D shape_xform, Vector2 shape_motion ) | |
void |
属性说明
- float custom_solver_bias
Default |
|
Setter | set_custom_solver_bias(value) |
Getter | get_custom_solver_bias() |
形状的自定义求解器偏差。
方法说明
- bool collide ( Transform2D local_xform, Shape2D with_shape, Transform2D shape_xform )
如果这个形状与另一个形状发生碰撞,返回true
。
这个方法需要这个形状的变换矩阵(local_xform
),要检查碰撞的形状(with_shape
),以及那个形状的变换矩阵(shape_xform
)。
- Array collide_and_get_contacts ( Transform2D local_xform, Shape2D with_shape, Transform2D shape_xform )
返回这个形状与另一个形状相接触的点的列表。如果没有碰撞,则列表为空。
这个方法需要这个形状的变换矩阵(local_xform
),要检查碰撞的形状(with_shape
),以及那个形状的变换矩阵(shape_xform
)。
- bool collide_with_motion ( Transform2D local_xform, Vector2 local_motion, Shape2D with_shape, Transform2D shape_xform, Vector2 shape_motion )
如果应用一个给定的运动,返回这个形状是否会与另一个形状发生碰撞。
这个方法需要这个形状的变换矩阵(local_xform
),要在这个形状上测试的运动(local_motion
),检查碰撞的形状(with_shape
),那个形状的变换矩阵(shape_xform
),以及用于测试其他物体的运动(shape_motion
)。
- Array collide_with_motion_and_get_contacts ( Transform2D local_xform, Vector2 local_motion, Shape2D with_shape, Transform2D shape_xform, Vector2 shape_motion )
如果应用了给定的移动,则返回此形状将与另一个形状接触的点的列表。如果没有碰撞,则列表为空。
这个方法需要这个形状的变换矩阵(local_xform
),这个形状上测试的运动(local_motion
),检查碰撞的形状(with_shape
)、那个形状的变换矩阵 (shape_xform
),以及在另一个对象上测试的运动 (shape_motion
)。
用VisualServerAPI在CanvasItem上绘制实体形状,并填充指定的color
。确切的绘制方法是每个形状特有的,无法配置。