Files
academy2/modules/detour/obstacle.cpp
2021-07-31 03:37:28 +03:00

26 lines
899 B
C++

#include "obstacle.h"
#include "detour.h"
DetourNavigationObstacle::DetourNavigationObstacle() :
mesh(0),
id(0),
radius(5.0f),
height(5.0f) {}
DetourNavigationObstacle::~DetourNavigationObstacle() {
if (mesh && id > 0)
mesh->remove_obstacle(id);
}
void DetourNavigationObstacle::_bind_methods()
{
ClassDB::bind_method(D_METHOD("get_radius"),
&DetourNavigationObstacle::get_radius);
ClassDB::bind_method(D_METHOD("set_radius", "radius"),
&DetourNavigationObstacle::set_radius);
ClassDB::bind_method(D_METHOD("get_height"),
&DetourNavigationObstacle::get_height);
ClassDB::bind_method(D_METHOD("set_height", "height"),
&DetourNavigationObstacle::set_height);
ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius", PROPERTY_HINT_NONE, ""), "set_radius", "get_radius");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "height", PROPERTY_HINT_NONE, ""), "set_height", "get_height");
}