Merge pull request #49476 from nekomatata/kinematic-collision-rid-3.x
[3.x] Expose collider RID in 2D/3D kinematic collision
This commit is contained in:
commit
fc95c4d84c
6 changed files with 18 additions and 0 deletions
|
@ -21,6 +21,9 @@
|
|||
<member name="collider_metadata" type="Variant" setter="" getter="get_collider_metadata">
|
||||
The colliding body's metadata. See [Object].
|
||||
</member>
|
||||
<member name="collider_rid" type="RID" setter="" getter="get_collider_rid">
|
||||
The colliding body's [RID] used by the [PhysicsServer].
|
||||
</member>
|
||||
<member name="collider_shape" type="Object" setter="" getter="get_collider_shape">
|
||||
The colliding body's shape.
|
||||
</member>
|
||||
|
|
|
@ -21,6 +21,9 @@
|
|||
<member name="collider_metadata" type="Variant" setter="" getter="get_collider_metadata">
|
||||
The colliding body's metadata. See [Object].
|
||||
</member>
|
||||
<member name="collider_rid" type="RID" setter="" getter="get_collider_rid">
|
||||
The colliding body's [RID] used by the [Physics2DServer].
|
||||
</member>
|
||||
<member name="collider_shape" type="Object" setter="" getter="get_collider_shape">
|
||||
The colliding body's shape.
|
||||
</member>
|
||||
|
|
|
@ -1392,6 +1392,9 @@ Object *KinematicCollision2D::get_collider() const {
|
|||
ObjectID KinematicCollision2D::get_collider_id() const {
|
||||
return collision.collider;
|
||||
}
|
||||
RID KinematicCollision2D::get_collider_rid() const {
|
||||
return collision.collider_rid;
|
||||
}
|
||||
Object *KinematicCollision2D::get_collider_shape() const {
|
||||
Object *collider = get_collider();
|
||||
if (collider) {
|
||||
|
@ -1422,6 +1425,7 @@ void KinematicCollision2D::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("get_local_shape"), &KinematicCollision2D::get_local_shape);
|
||||
ClassDB::bind_method(D_METHOD("get_collider"), &KinematicCollision2D::get_collider);
|
||||
ClassDB::bind_method(D_METHOD("get_collider_id"), &KinematicCollision2D::get_collider_id);
|
||||
ClassDB::bind_method(D_METHOD("get_collider_rid"), &KinematicCollision2D::get_collider_rid);
|
||||
ClassDB::bind_method(D_METHOD("get_collider_shape"), &KinematicCollision2D::get_collider_shape);
|
||||
ClassDB::bind_method(D_METHOD("get_collider_shape_index"), &KinematicCollision2D::get_collider_shape_index);
|
||||
ClassDB::bind_method(D_METHOD("get_collider_velocity"), &KinematicCollision2D::get_collider_velocity);
|
||||
|
@ -1434,6 +1438,7 @@ void KinematicCollision2D::_bind_methods() {
|
|||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "local_shape"), "", "get_local_shape");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "collider"), "", "get_collider");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "collider_id"), "", "get_collider_id");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::_RID, "collider_rid"), "", "get_collider_rid");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "collider_shape"), "", "get_collider_shape");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "collider_shape_index"), "", "get_collider_shape_index");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "collider_velocity"), "", "get_collider_velocity");
|
||||
|
|
|
@ -355,6 +355,7 @@ public:
|
|||
Object *get_local_shape() const;
|
||||
Object *get_collider() const;
|
||||
ObjectID get_collider_id() const;
|
||||
RID get_collider_rid() const;
|
||||
Object *get_collider_shape() const;
|
||||
int get_collider_shape_index() const;
|
||||
Vector2 get_collider_velocity() const;
|
||||
|
|
|
@ -1335,6 +1335,9 @@ Object *KinematicCollision::get_collider() const {
|
|||
ObjectID KinematicCollision::get_collider_id() const {
|
||||
return collision.collider;
|
||||
}
|
||||
RID KinematicCollision::get_collider_rid() const {
|
||||
return collision.collider_rid;
|
||||
}
|
||||
Object *KinematicCollision::get_collider_shape() const {
|
||||
Object *collider = get_collider();
|
||||
if (collider) {
|
||||
|
@ -1365,6 +1368,7 @@ void KinematicCollision::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("get_local_shape"), &KinematicCollision::get_local_shape);
|
||||
ClassDB::bind_method(D_METHOD("get_collider"), &KinematicCollision::get_collider);
|
||||
ClassDB::bind_method(D_METHOD("get_collider_id"), &KinematicCollision::get_collider_id);
|
||||
ClassDB::bind_method(D_METHOD("get_collider_rid"), &KinematicCollision::get_collider_rid);
|
||||
ClassDB::bind_method(D_METHOD("get_collider_shape"), &KinematicCollision::get_collider_shape);
|
||||
ClassDB::bind_method(D_METHOD("get_collider_shape_index"), &KinematicCollision::get_collider_shape_index);
|
||||
ClassDB::bind_method(D_METHOD("get_collider_velocity"), &KinematicCollision::get_collider_velocity);
|
||||
|
@ -1377,6 +1381,7 @@ void KinematicCollision::_bind_methods() {
|
|||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "local_shape"), "", "get_local_shape");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "collider"), "", "get_collider");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "collider_id"), "", "get_collider_id");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::_RID, "collider_rid"), "", "get_collider_rid");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "collider_shape"), "", "get_collider_shape");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "collider_shape_index"), "", "get_collider_shape_index");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "collider_velocity"), "", "get_collider_velocity");
|
||||
|
|
|
@ -346,6 +346,7 @@ public:
|
|||
Object *get_local_shape() const;
|
||||
Object *get_collider() const;
|
||||
ObjectID get_collider_id() const;
|
||||
RID get_collider_rid() const;
|
||||
Object *get_collider_shape() const;
|
||||
int get_collider_shape_index() const;
|
||||
Vector3 get_collider_velocity() const;
|
||||
|
|
Loading…
Reference in a new issue