Skip to content

Commit

Permalink
Expose physics RID
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan-000 authored and TokisanGames committed Aug 1, 2024
1 parent cb57596 commit 89a047a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/terrain_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,17 @@ void Terrain3D::set_collision_priority(const real_t p_priority) {
}
}

RID Terrain3D::get_collision_rid() const {
if (!_show_debug_collision) {
return _static_body;
} else {
if (_debug_static_body != nullptr) {
return _debug_static_body->get_rid();
}
}
return RID();
}

/**
* Centers the terrain and LODs on a provided position. Y height is ignored.
*/
Expand Down Expand Up @@ -1259,6 +1270,7 @@ void Terrain3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_collision_mask"), &Terrain3D::get_collision_mask);
ClassDB::bind_method(D_METHOD("set_collision_priority", "priority"), &Terrain3D::set_collision_priority);
ClassDB::bind_method(D_METHOD("get_collision_priority"), &Terrain3D::get_collision_priority);
ClassDB::bind_method(D_METHOD("get_collision_rid"), &Terrain3D::get_collision_rid);

ClassDB::bind_method(D_METHOD("get_intersection", "src_pos", "direction"), &Terrain3D::get_intersection);
ClassDB::bind_method(D_METHOD("bake_mesh", "lod", "filter"), &Terrain3D::bake_mesh);
Expand Down
1 change: 1 addition & 0 deletions src/terrain_3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ class Terrain3D : public Node3D {
uint32_t get_collision_mask() const { return _collision_mask; };
void set_collision_priority(const real_t p_priority);
real_t get_collision_priority() const { return _collision_priority; }
RID get_collision_rid() const;

// Terrain methods
void snap(const Vector3 &p_cam_pos);
Expand Down

0 comments on commit 89a047a

Please sign in to comment.