path_3d.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561
  1. /**************************************************************************/
  2. /* path_3d.cpp */
  3. /**************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /**************************************************************************/
  8. /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
  9. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /**************************************************************************/
  30. #include "path_3d.h"
  31. Path3D::Path3D() {
  32. SceneTree *st = SceneTree::get_singleton();
  33. if (st && st->is_debugging_paths_hint()) {
  34. debug_instance = RS::get_singleton()->instance_create();
  35. set_notify_transform(true);
  36. _update_debug_mesh();
  37. }
  38. }
  39. Path3D::~Path3D() {
  40. if (debug_instance.is_valid()) {
  41. ERR_FAIL_NULL(RenderingServer::get_singleton());
  42. RS::get_singleton()->free(debug_instance);
  43. }
  44. if (debug_mesh.is_valid()) {
  45. ERR_FAIL_NULL(RenderingServer::get_singleton());
  46. RS::get_singleton()->free(debug_mesh->get_rid());
  47. }
  48. }
  49. void Path3D::set_update_callback(Callable p_callback) {
  50. update_callback = p_callback;
  51. }
  52. void Path3D::_notification(int p_what) {
  53. switch (p_what) {
  54. case NOTIFICATION_ENTER_TREE: {
  55. SceneTree *st = SceneTree::get_singleton();
  56. if (st && st->is_debugging_paths_hint()) {
  57. _update_debug_mesh();
  58. }
  59. } break;
  60. case NOTIFICATION_EXIT_TREE: {
  61. SceneTree *st = SceneTree::get_singleton();
  62. if (st && st->is_debugging_paths_hint()) {
  63. RS::get_singleton()->instance_set_visible(debug_instance, false);
  64. }
  65. } break;
  66. case NOTIFICATION_TRANSFORM_CHANGED: {
  67. if (is_inside_tree()) {
  68. if (debug_instance.is_valid()) {
  69. RS::get_singleton()->instance_set_transform(debug_instance, get_global_transform());
  70. }
  71. update_callback.call();
  72. }
  73. } break;
  74. }
  75. }
  76. void Path3D::_update_debug_mesh() {
  77. SceneTree *st = SceneTree::get_singleton();
  78. if (!(st && st->is_debugging_paths_hint())) {
  79. return;
  80. }
  81. if (debug_mesh.is_null()) {
  82. debug_mesh.instantiate();
  83. }
  84. if (curve.is_null()) {
  85. RS::get_singleton()->instance_set_visible(debug_instance, false);
  86. return;
  87. }
  88. if (curve->get_point_count() < 2) {
  89. RS::get_singleton()->instance_set_visible(debug_instance, false);
  90. return;
  91. }
  92. real_t interval = 0.1;
  93. const real_t length = curve->get_baked_length();
  94. if (length <= CMP_EPSILON) {
  95. RS::get_singleton()->instance_set_visible(debug_instance, false);
  96. return;
  97. }
  98. const int sample_count = int(length / interval) + 2;
  99. interval = length / (sample_count - 1);
  100. Vector<Vector3> ribbon;
  101. ribbon.resize(sample_count);
  102. Vector3 *ribbon_ptr = ribbon.ptrw();
  103. Vector<Vector3> bones;
  104. bones.resize(sample_count * 4);
  105. Vector3 *bones_ptr = bones.ptrw();
  106. for (int i = 0; i < sample_count; i++) {
  107. const Transform3D r = curve->sample_baked_with_rotation(i * interval, true, true);
  108. const Vector3 p1 = r.origin;
  109. const Vector3 side = r.basis.get_column(0);
  110. const Vector3 up = r.basis.get_column(1);
  111. const Vector3 forward = r.basis.get_column(2);
  112. // Path3D as a ribbon.
  113. ribbon_ptr[i] = p1;
  114. if (i % 4 == 0) {
  115. // Draw fish bone every 4 points to reduce visual noise and performance impact
  116. // (compared to drawing it for every point).
  117. const Vector3 p_left = p1 + (side + forward - up * 0.3) * 0.06;
  118. const Vector3 p_right = p1 + (-side + forward - up * 0.3) * 0.06;
  119. const int bone_idx = i * 4;
  120. bones_ptr[bone_idx] = p1;
  121. bones_ptr[bone_idx + 1] = p_left;
  122. bones_ptr[bone_idx + 2] = p1;
  123. bones_ptr[bone_idx + 3] = p_right;
  124. }
  125. }
  126. Array ribbon_array;
  127. ribbon_array.resize(Mesh::ARRAY_MAX);
  128. ribbon_array[Mesh::ARRAY_VERTEX] = ribbon;
  129. Array bone_array;
  130. bone_array.resize(Mesh::ARRAY_MAX);
  131. bone_array[Mesh::ARRAY_VERTEX] = bones;
  132. _update_debug_path_material();
  133. debug_mesh->clear_surfaces();
  134. debug_mesh->add_surface_from_arrays(Mesh::PRIMITIVE_LINE_STRIP, ribbon_array);
  135. debug_mesh->add_surface_from_arrays(Mesh::PRIMITIVE_LINES, bone_array);
  136. debug_mesh->surface_set_material(0, debug_material);
  137. debug_mesh->surface_set_material(1, debug_material);
  138. RS::get_singleton()->instance_set_base(debug_instance, debug_mesh->get_rid());
  139. if (is_inside_tree()) {
  140. RS::get_singleton()->instance_set_scenario(debug_instance, get_world_3d()->get_scenario());
  141. RS::get_singleton()->instance_set_transform(debug_instance, get_global_transform());
  142. RS::get_singleton()->instance_set_visible(debug_instance, is_visible_in_tree());
  143. }
  144. }
  145. void Path3D::set_debug_custom_color(const Color &p_color) {
  146. debug_custom_color = p_color;
  147. _update_debug_path_material();
  148. }
  149. Ref<StandardMaterial3D> Path3D::get_debug_material() {
  150. return debug_material;
  151. }
  152. const Color &Path3D::get_debug_custom_color() const {
  153. return debug_custom_color;
  154. }
  155. void Path3D::_update_debug_path_material() {
  156. SceneTree *st = SceneTree::get_singleton();
  157. if (!debug_material.is_valid()) {
  158. Ref<StandardMaterial3D> material = memnew(StandardMaterial3D);
  159. debug_material = material;
  160. material->set_shading_mode(StandardMaterial3D::SHADING_MODE_UNSHADED);
  161. material->set_transparency(StandardMaterial3D::TRANSPARENCY_ALPHA);
  162. material->set_flag(StandardMaterial3D::FLAG_SRGB_VERTEX_COLOR, true);
  163. material->set_flag(StandardMaterial3D::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
  164. material->set_flag(StandardMaterial3D::FLAG_DISABLE_FOG, true);
  165. }
  166. Color color = debug_custom_color;
  167. if (color == Color(0.0, 0.0, 0.0)) {
  168. // Use the default debug path color defined in the Project Settings.
  169. color = st->get_debug_paths_color();
  170. }
  171. get_debug_material()->set_albedo(color);
  172. emit_signal(SNAME("debug_color_changed"));
  173. }
  174. void Path3D::_curve_changed() {
  175. if (is_inside_tree() && Engine::get_singleton()->is_editor_hint()) {
  176. update_gizmos();
  177. }
  178. if (is_inside_tree()) {
  179. emit_signal(SNAME("curve_changed"));
  180. }
  181. // Update the configuration warnings of all children of type PathFollow
  182. // previously used for PathFollowOriented (now enforced orientation is done in PathFollow). Also trigger transform update on PathFollow3Ds in deferred mode.
  183. if (is_inside_tree()) {
  184. for (int i = 0; i < get_child_count(); i++) {
  185. PathFollow3D *child = Object::cast_to<PathFollow3D>(get_child(i));
  186. if (child) {
  187. child->update_configuration_warnings();
  188. child->update_transform();
  189. }
  190. }
  191. }
  192. SceneTree *st = SceneTree::get_singleton();
  193. if (st && st->is_debugging_paths_hint()) {
  194. _update_debug_mesh();
  195. }
  196. }
  197. void Path3D::set_curve(const Ref<Curve3D> &p_curve) {
  198. if (curve.is_valid()) {
  199. curve->disconnect_changed(callable_mp(this, &Path3D::_curve_changed));
  200. }
  201. curve = p_curve;
  202. if (curve.is_valid()) {
  203. curve->connect_changed(callable_mp(this, &Path3D::_curve_changed));
  204. }
  205. _curve_changed();
  206. }
  207. Ref<Curve3D> Path3D::get_curve() const {
  208. return curve;
  209. }
  210. void Path3D::_bind_methods() {
  211. ClassDB::bind_method(D_METHOD("set_curve", "curve"), &Path3D::set_curve);
  212. ClassDB::bind_method(D_METHOD("get_curve"), &Path3D::get_curve);
  213. ClassDB::bind_method(D_METHOD("set_debug_custom_color", "debug_custom_color"), &Path3D::set_debug_custom_color);
  214. ClassDB::bind_method(D_METHOD("get_debug_custom_color"), &Path3D::get_debug_custom_color);
  215. ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "curve", PROPERTY_HINT_RESOURCE_TYPE, "Curve3D", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_EDITOR_INSTANTIATE_OBJECT), "set_curve", "get_curve");
  216. ADD_GROUP("Debug Shape", "debug_");
  217. ADD_PROPERTY(PropertyInfo(Variant::COLOR, "debug_custom_color"), "set_debug_custom_color", "get_debug_custom_color");
  218. ADD_SIGNAL(MethodInfo("curve_changed"));
  219. ADD_SIGNAL(MethodInfo("debug_color_changed"));
  220. }
  221. void PathFollow3D::update_transform() {
  222. if (!path) {
  223. return;
  224. }
  225. Ref<Curve3D> c = path->get_curve();
  226. if (c.is_null()) {
  227. return;
  228. }
  229. real_t bl = c->get_baked_length();
  230. if (bl == 0.0) {
  231. return;
  232. }
  233. Transform3D t;
  234. if (rotation_mode == ROTATION_NONE) {
  235. Vector3 pos = c->sample_baked(progress, cubic);
  236. t.origin = pos;
  237. } else {
  238. t = c->sample_baked_with_rotation(progress, cubic, false);
  239. Vector3 tangent = -t.basis.get_column(2); // Retain tangent for applying tilt.
  240. t = PathFollow3D::correct_posture(t, rotation_mode);
  241. // Switch Z+ and Z- if necessary.
  242. if (use_model_front) {
  243. t.basis *= Basis::from_scale(Vector3(-1.0, 1.0, -1.0));
  244. }
  245. // Apply tilt *after* correct_posture().
  246. if (tilt_enabled) {
  247. const real_t tilt = c->sample_baked_tilt(progress);
  248. const Basis twist(tangent, tilt);
  249. t.basis = twist * t.basis;
  250. }
  251. }
  252. // Apply offset and scale.
  253. Vector3 scale = get_transform().basis.get_scale();
  254. t.translate_local(Vector3(h_offset, v_offset, 0));
  255. t.basis.scale_local(scale);
  256. set_transform(t);
  257. }
  258. void PathFollow3D::_notification(int p_what) {
  259. switch (p_what) {
  260. case NOTIFICATION_ENTER_TREE: {
  261. Node *parent = get_parent();
  262. if (parent) {
  263. path = Object::cast_to<Path3D>(parent);
  264. update_transform();
  265. }
  266. } break;
  267. case NOTIFICATION_EXIT_TREE: {
  268. path = nullptr;
  269. } break;
  270. }
  271. }
  272. void PathFollow3D::set_cubic_interpolation_enabled(bool p_enabled) {
  273. cubic = p_enabled;
  274. }
  275. bool PathFollow3D::is_cubic_interpolation_enabled() const {
  276. return cubic;
  277. }
  278. void PathFollow3D::_validate_property(PropertyInfo &p_property) const {
  279. if (p_property.name == "offset") {
  280. real_t max = 10000;
  281. if (path && path->get_curve().is_valid()) {
  282. max = path->get_curve()->get_baked_length();
  283. }
  284. p_property.hint_string = "0," + rtos(max) + ",0.01,or_less,or_greater";
  285. }
  286. }
  287. PackedStringArray PathFollow3D::get_configuration_warnings() const {
  288. PackedStringArray warnings = Node3D::get_configuration_warnings();
  289. if (is_visible_in_tree() && is_inside_tree()) {
  290. if (!Object::cast_to<Path3D>(get_parent())) {
  291. warnings.push_back(RTR("PathFollow3D only works when set as a child of a Path3D node."));
  292. } else {
  293. Path3D *p = Object::cast_to<Path3D>(get_parent());
  294. if (p->get_curve().is_valid() && !p->get_curve()->is_up_vector_enabled() && rotation_mode == ROTATION_ORIENTED) {
  295. warnings.push_back(RTR("PathFollow3D's ROTATION_ORIENTED requires \"Up Vector\" to be enabled in its parent Path3D's Curve resource."));
  296. }
  297. }
  298. }
  299. return warnings;
  300. }
  301. Transform3D PathFollow3D::correct_posture(Transform3D p_transform, PathFollow3D::RotationMode p_rotation_mode) {
  302. Transform3D t = p_transform;
  303. // Modify frame according to rotation mode.
  304. if (p_rotation_mode == PathFollow3D::ROTATION_NONE) {
  305. // Clear rotation.
  306. t.basis = Basis();
  307. } else if (p_rotation_mode == PathFollow3D::ROTATION_ORIENTED) {
  308. Vector3 tangent = -t.basis.get_column(2);
  309. // Y-axis points up by default.
  310. t.basis = Basis::looking_at(tangent);
  311. } else {
  312. // Lock some euler axes.
  313. Vector3 euler = t.basis.get_euler_normalized(EulerOrder::YXZ);
  314. if (p_rotation_mode == PathFollow3D::ROTATION_Y) {
  315. // Only Y-axis allowed.
  316. euler[0] = 0;
  317. euler[2] = 0;
  318. } else if (p_rotation_mode == PathFollow3D::ROTATION_XY) {
  319. // XY allowed.
  320. euler[2] = 0;
  321. }
  322. Basis locked = Basis::from_euler(euler, EulerOrder::YXZ);
  323. t.basis = locked;
  324. }
  325. return t;
  326. }
  327. void PathFollow3D::_bind_methods() {
  328. ClassDB::bind_method(D_METHOD("set_progress", "progress"), &PathFollow3D::set_progress);
  329. ClassDB::bind_method(D_METHOD("get_progress"), &PathFollow3D::get_progress);
  330. ClassDB::bind_method(D_METHOD("set_h_offset", "h_offset"), &PathFollow3D::set_h_offset);
  331. ClassDB::bind_method(D_METHOD("get_h_offset"), &PathFollow3D::get_h_offset);
  332. ClassDB::bind_method(D_METHOD("set_v_offset", "v_offset"), &PathFollow3D::set_v_offset);
  333. ClassDB::bind_method(D_METHOD("get_v_offset"), &PathFollow3D::get_v_offset);
  334. ClassDB::bind_method(D_METHOD("set_progress_ratio", "ratio"), &PathFollow3D::set_progress_ratio);
  335. ClassDB::bind_method(D_METHOD("get_progress_ratio"), &PathFollow3D::get_progress_ratio);
  336. ClassDB::bind_method(D_METHOD("set_rotation_mode", "rotation_mode"), &PathFollow3D::set_rotation_mode);
  337. ClassDB::bind_method(D_METHOD("get_rotation_mode"), &PathFollow3D::get_rotation_mode);
  338. ClassDB::bind_method(D_METHOD("set_cubic_interpolation", "enabled"), &PathFollow3D::set_cubic_interpolation_enabled);
  339. ClassDB::bind_method(D_METHOD("get_cubic_interpolation"), &PathFollow3D::is_cubic_interpolation_enabled);
  340. ClassDB::bind_method(D_METHOD("set_use_model_front", "enabled"), &PathFollow3D::set_use_model_front);
  341. ClassDB::bind_method(D_METHOD("is_using_model_front"), &PathFollow3D::is_using_model_front);
  342. ClassDB::bind_method(D_METHOD("set_loop", "loop"), &PathFollow3D::set_loop);
  343. ClassDB::bind_method(D_METHOD("has_loop"), &PathFollow3D::has_loop);
  344. ClassDB::bind_method(D_METHOD("set_tilt_enabled", "enabled"), &PathFollow3D::set_tilt_enabled);
  345. ClassDB::bind_method(D_METHOD("is_tilt_enabled"), &PathFollow3D::is_tilt_enabled);
  346. ClassDB::bind_static_method("PathFollow3D", D_METHOD("correct_posture", "transform", "rotation_mode"), &PathFollow3D::correct_posture);
  347. ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "progress", PROPERTY_HINT_RANGE, "0,10000,0.01,or_less,or_greater,suffix:m"), "set_progress", "get_progress");
  348. ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "progress_ratio", PROPERTY_HINT_RANGE, "0,1,0.0001,or_less,or_greater", PROPERTY_USAGE_EDITOR), "set_progress_ratio", "get_progress_ratio");
  349. ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "h_offset", PROPERTY_HINT_NONE, "suffix:m"), "set_h_offset", "get_h_offset");
  350. ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "v_offset", PROPERTY_HINT_NONE, "suffix:m"), "set_v_offset", "get_v_offset");
  351. ADD_PROPERTY(PropertyInfo(Variant::INT, "rotation_mode", PROPERTY_HINT_ENUM, "None,Y,XY,XYZ,Oriented"), "set_rotation_mode", "get_rotation_mode");
  352. ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_model_front"), "set_use_model_front", "is_using_model_front");
  353. ADD_PROPERTY(PropertyInfo(Variant::BOOL, "cubic_interp"), "set_cubic_interpolation", "get_cubic_interpolation");
  354. ADD_PROPERTY(PropertyInfo(Variant::BOOL, "loop"), "set_loop", "has_loop");
  355. ADD_PROPERTY(PropertyInfo(Variant::BOOL, "tilt_enabled"), "set_tilt_enabled", "is_tilt_enabled");
  356. BIND_ENUM_CONSTANT(ROTATION_NONE);
  357. BIND_ENUM_CONSTANT(ROTATION_Y);
  358. BIND_ENUM_CONSTANT(ROTATION_XY);
  359. BIND_ENUM_CONSTANT(ROTATION_XYZ);
  360. BIND_ENUM_CONSTANT(ROTATION_ORIENTED);
  361. }
  362. void PathFollow3D::set_progress(real_t p_progress) {
  363. ERR_FAIL_COND(!std::isfinite(p_progress));
  364. if (progress == p_progress) {
  365. return;
  366. }
  367. progress = p_progress;
  368. if (path) {
  369. if (path->get_curve().is_valid()) {
  370. real_t path_length = path->get_curve()->get_baked_length();
  371. if (loop && path_length) {
  372. progress = Math::fposmod(progress, path_length);
  373. if (!Math::is_zero_approx(p_progress) && Math::is_zero_approx(progress)) {
  374. progress = path_length;
  375. }
  376. } else {
  377. progress = CLAMP(progress, 0, path_length);
  378. }
  379. }
  380. update_transform();
  381. }
  382. }
  383. void PathFollow3D::set_h_offset(real_t p_h_offset) {
  384. if (h_offset == p_h_offset) {
  385. return;
  386. }
  387. h_offset = p_h_offset;
  388. update_transform();
  389. }
  390. real_t PathFollow3D::get_h_offset() const {
  391. return h_offset;
  392. }
  393. void PathFollow3D::set_v_offset(real_t p_v_offset) {
  394. if (v_offset == p_v_offset) {
  395. return;
  396. }
  397. v_offset = p_v_offset;
  398. update_transform();
  399. }
  400. real_t PathFollow3D::get_v_offset() const {
  401. return v_offset;
  402. }
  403. real_t PathFollow3D::get_progress() const {
  404. return progress;
  405. }
  406. void PathFollow3D::set_progress_ratio(real_t p_ratio) {
  407. ERR_FAIL_NULL_MSG(path, "Can only set progress ratio on a PathFollow3D that is the child of a Path3D which is itself part of the scene tree.");
  408. ERR_FAIL_COND_MSG(path->get_curve().is_null(), "Can't set progress ratio on a PathFollow3D that does not have a Curve.");
  409. ERR_FAIL_COND_MSG(!path->get_curve()->get_baked_length(), "Can't set progress ratio on a PathFollow3D that has a 0 length curve.");
  410. set_progress(p_ratio * path->get_curve()->get_baked_length());
  411. }
  412. real_t PathFollow3D::get_progress_ratio() const {
  413. if (path && path->get_curve().is_valid() && path->get_curve()->get_baked_length()) {
  414. return get_progress() / path->get_curve()->get_baked_length();
  415. } else {
  416. return 0;
  417. }
  418. }
  419. void PathFollow3D::set_rotation_mode(RotationMode p_rotation_mode) {
  420. if (rotation_mode == p_rotation_mode) {
  421. return;
  422. }
  423. rotation_mode = p_rotation_mode;
  424. update_configuration_warnings();
  425. update_transform();
  426. }
  427. PathFollow3D::RotationMode PathFollow3D::get_rotation_mode() const {
  428. return rotation_mode;
  429. }
  430. void PathFollow3D::set_use_model_front(bool p_use_model_front) {
  431. if (use_model_front == p_use_model_front) {
  432. return;
  433. }
  434. use_model_front = p_use_model_front;
  435. update_transform();
  436. }
  437. bool PathFollow3D::is_using_model_front() const {
  438. return use_model_front;
  439. }
  440. void PathFollow3D::set_loop(bool p_loop) {
  441. if (loop == p_loop) {
  442. return;
  443. }
  444. loop = p_loop;
  445. update_transform();
  446. }
  447. bool PathFollow3D::has_loop() const {
  448. return loop;
  449. }
  450. void PathFollow3D::set_tilt_enabled(bool p_enabled) {
  451. if (tilt_enabled == p_enabled) {
  452. return;
  453. }
  454. tilt_enabled = p_enabled;
  455. update_transform();
  456. }
  457. bool PathFollow3D::is_tilt_enabled() const {
  458. return tilt_enabled;
  459. }