Expose collider RID in 2D/3D kinematic collision
Can be useful to access the colliding body information for bodies
created with the physics server directly.
(cherry picked from commit a146e79758
)
This commit is contained in:
parent
cefef7db05
commit
0938958111
@ -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>
|
||||
|
@ -1552,6 +1552,9 @@ 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();
|
||||
@ -1587,6 +1590,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);
|
||||
@ -1599,6 +1603,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");
|
||||
|
@ -377,6 +377,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;
|
||||
|
@ -1489,6 +1489,9 @@ 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();
|
||||
@ -1524,6 +1527,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);
|
||||
@ -1536,6 +1540,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");
|
||||
|
@ -368,6 +368,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 New Issue
Block a user