godot stuff
This commit is contained in:
parent
aacd8e92ad
commit
7cafc09390
3 changed files with 155 additions and 128 deletions
|
@ -1 +1 @@
|
|||
Subproject commit 21d526e5e5b1e5d8b6be4db05a704c2c2e7837a9
|
||||
Subproject commit a62f633cebee4b36356dc903d00670733cd28fb1
|
|
@ -1,4 +1,5 @@
|
|||
#include "RecastNavMesh.hpp"
|
||||
#include <godot_cpp/classes/global_constants.hpp>
|
||||
|
||||
godot::RecastNavMesh::RecastNavMesh() {
|
||||
}
|
||||
|
@ -44,6 +45,18 @@ void godot::RecastNavMesh::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("get_walkable_height"), &RecastNavMesh::get_walkable_height);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "walkable_height"), "set_walkable_height", "get_walkable_height");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_filter_low_hanging_obstacles", "filter_low_hanging_obstacles"), &RecastNavMesh::set_filter_low_hanging_obstacles);
|
||||
ClassDB::bind_method(D_METHOD("get_filter_low_hanging_obstacles"), &RecastNavMesh::get_filter_low_hanging_obstacles);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "filter_low_hanging_obstacles"), "set_filter_low_hanging_obstacles", "get_filter_low_hanging_obstacles");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_filter_ledge_spans", "filter_ledge_spans"), &RecastNavMesh::set_filter_ledge_spans);
|
||||
ClassDB::bind_method(D_METHOD("get_filter_ledge_spans"), &RecastNavMesh::get_filter_ledge_spans);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "filter_ledge_spans"), "set_filter_ledge_spans", "get_filter_ledge_spans");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_filter_walkable_low_height_spans", "filter_walkable_low_height_spans"), &RecastNavMesh::set_filter_walkable_low_height_spans);
|
||||
ClassDB::bind_method(D_METHOD("get_filter_walkable_low_height_spans"), &RecastNavMesh::get_filter_walkable_low_height_spans);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "filter_walkable_low_height_spans"), "set_filter_walkable_low_height_spans", "get_filter_walkable_low_height_spans");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_walkable_climb", "walkable_climb"), &RecastNavMesh::set_walkable_climb);
|
||||
ClassDB::bind_method(D_METHOD("get_walkable_climb"), &RecastNavMesh::get_walkable_climb);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "walkable_climb"), "set_walkable_climb", "get_walkable_climb");
|
||||
|
|
|
@ -7,23 +7,29 @@
|
|||
|
||||
namespace godot {
|
||||
|
||||
enum RecastPartitionType {
|
||||
enum RecastPartitionType {
|
||||
WATERSHED = 0,
|
||||
MONOTONE,
|
||||
LAYERS,
|
||||
PARTITION_TYPE_COUNT
|
||||
};
|
||||
};
|
||||
|
||||
class RecastNavMesh : public Node3D {
|
||||
class RecastNavMesh : public Node3D {
|
||||
GDCLASS(RecastNavMesh, Node3D)
|
||||
private:
|
||||
private:
|
||||
bool m_calculated = false;
|
||||
bool filter_low_hanging_obstacles = false;
|
||||
bool filter_ledge_spans = false;
|
||||
bool filter_walkable_low_height_spans = false;
|
||||
|
||||
rcConfig config;
|
||||
RecastPartitionType partition_type = WATERSHED;
|
||||
|
||||
rcHeightfield* m_heightfield = NULL;
|
||||
protected:
|
||||
rcCompactHeightfield* m_compact_heightfield = NULL;
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
public:
|
||||
public:
|
||||
RecastNavMesh();
|
||||
~RecastNavMesh();
|
||||
// config
|
||||
|
@ -71,6 +77,14 @@ namespace godot {
|
|||
Vector3 get_bmax() {
|
||||
return Vector3(config.bmax[0], config.bmax[1], config.bmax[2]);
|
||||
}
|
||||
|
||||
void set_filter_low_hanging_obstacles(bool filter_low_hanging_obstacles) { this->filter_low_hanging_obstacles = filter_low_hanging_obstacles; }
|
||||
bool get_filter_low_hanging_obstacles() { return filter_low_hanging_obstacles; }
|
||||
void set_filter_ledge_spans(bool filter_ledge_spans) { this->filter_ledge_spans = filter_ledge_spans; }
|
||||
bool get_filter_ledge_spans() { return filter_ledge_spans; }
|
||||
void set_filter_walkable_low_height_spans(bool filter_walkable_low_height_spans) { this->filter_walkable_low_height_spans = filter_walkable_low_height_spans; }
|
||||
bool get_filter_walkable_low_height_spans() { return filter_walkable_low_height_spans; }
|
||||
|
||||
/// The maximum slope that is considered walkable. [Limits: 0 <= value < 90] [Units: Degrees]
|
||||
void set_walkable_slope_angle(float walkable_slope_angle) { config.walkableSlopeAngle = walkable_slope_angle; }
|
||||
float get_walkable_slope_angle() { return config.walkableSlopeAngle; }
|
||||
|
@ -127,7 +141,7 @@ namespace godot {
|
|||
int get_partition_type() {
|
||||
return (int)partition_type;
|
||||
}
|
||||
|
||||
public:
|
||||
// Recast
|
||||
bool init();
|
||||
void cleanup();
|
||||
|
@ -135,6 +149,6 @@ namespace godot {
|
|||
void add_vertices(PackedByteArray vertices, unsigned char area_id);
|
||||
bool recalculate_navmesh();
|
||||
bool is_calculated() { return m_calculated; }
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue