跳到主要内容

CollisionObject2D

继承

Node2D

简要描述

2D碰撞对象的基本节点。

描述

CollisionObject2D是2D物理对象的基类。

成员

类型属性名默认值
boolinput_pickabletrue

方法

返回值类型方法名称
void_input_event(viewport: Object, event: InputEvent, shape_idx: int) virtual
intcreate_shape_owner(owner: Object)
RIDget_rid() const
floatget_shape_owner_one_way_collision_margin(owner_id: int) const
Arrayget_shape_owners()
boolis_shape_owner_disabled(owner_id: int) const
boolis_shape_owner_one_way_collision_enabled(owner_id: int) const
voidremove_shape_owner(owner_id: int)
intshape_find_owner(shape_index: int) const
voidshape_owner_add_shape(owner_id: int, shape: Shape2D)
voidshape_owner_clear_shapes(owner_id: int)
Objectshape_owner_get_owner(owner_id: int) const
Shape2Dshape_owner_get_shape(owner_id: int, shape_id: int) const
intshape_owner_get_shape_count(owner_id: int) const
intshape_owner_get_shape_index(owner_id: int, shape_id: int) const
Transform2Dshape_owner_get_transform(owner_id: int) const
voidshape_owner_remove_shape(owner_id: int, shape_id: int)
voidshape_owner_set_disabled(owner_id: int, disabled: bool)
voidshape_owner_set_one_way_collision(owner_id: int, enable: bool)
voidshape_owner_set_one_way_collision_margin(owner_id: int, margin: float)
voidshape_owner_set_transform(owner_id: int, transform: Transform2D)

信号

  • **input_event**

在发生输入事件时发出。


  • **mouse_entered**

当鼠标指针进入该对象的任何形状时触发。


  • **mouse_exited**

当鼠标指针退出此对象的所有形状时发出。


常量

成员说明

  • bool input_pickable
Defaulttrue
setterset_pickable(value)
getteris_pickable

方法说明

  • _input_event _input_event(viewport: Object, event: InputEvent, shape_idx: int) virtual

接受未处理的InputEvent


  • create_shape_owner create_shape_owner(owner: Object)

为给定对象创建一个新的形状。


  • get_rid get_rid() const

返回对象的RID


  • get_shape_owner_one_way_collision_margin get_shape_owner_one_way_collision_margin(owner_id: int) const

返回由给定的owner_id标识的形状所有者的one_way_collision_margin


  • get_shape_owners get_shape_owners()

返回owner_id标识符的Array


  • is_shape_owner_disabled is_shape_owner_disabled(owner_id: int) const

如果true,则禁用形状所有者及其形状。


  • is_shape_owner_one_way_collision_enabled is_shape_owner_one_way_collision_enabled(owner_id: int) const

如果不报告源自此CollisionObject2D的形状所有者的碰撞,则返回true


  • remove_shape_owner remove_shape_owner(owner_id: int)

删除给定的形状。


  • shape_find_owner shape_find_owner(shape_index: int) const

返回给定形状的owner_id


  • shape_owner_add_shape shape_owner_add_shape(owner_id: int, shape: Shape2D)

Shape2D添加到形状。


  • shape_owner_clear_shapes shape_owner_clear_shapes(owner_id: int)

从形状所有者中删除所有形状。


  • shape_owner_get_owner shape_owner_get_owner(owner_id: int) const

返回给定形状所有者的父对象。


  • shape_owner_get_shape shape_owner_get_shape(owner_id: int, shape_id: int) const

从给定的形状所有者返回具有给定ID的Shape2D


  • shape_owner_get_shape_count shape_owner_get_shape_count(owner_id: int) const

返回给定形状所有者包含的形状数。


  • shape_owner_get_shape_index shape_owner_get_shape_index(owner_id: int, shape_id: int) const

从给定的形状所有者返回具有给定id的Shape2D的子索引。


  • shape_owner_get_transform shape_owner_get_transform(owner_id: int) const

返回形状所有者的Transform2D


  • shape_owner_remove_shape shape_owner_remove_shape(owner_id: int, shape_id: int)

从给定的形状所有者中删除形状。


  • shape_owner_set_disabled shape_owner_set_disabled(owner_id: int, disabled: bool)

如果true,则禁用给定的形状。


  • shape_owner_set_one_way_collision shape_owner_set_one_way_collision(owner_id: int, enable: bool)

如果enabletrue,则不会报告源自此CollisionObject2D的形状的碰撞与CollisionObject2D发生碰撞。


  • shape_owner_set_one_way_collision_margin shape_owner_set_one_way_collision_margin(owner_id: int, margin: float)

将由给定的owner_id标识的形状的one_way_collision_margin设置为margin像素。


  • shape_owner_set_transform shape_owner_set_transform(owner_id: int, transform: Transform2D)

设置给定形状的Transform2D