2023-01-05 13:25:55 +01:00
|
|
|
/**************************************************************************/
|
|
|
|
/* godot_area_3d.cpp */
|
|
|
|
/**************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
|
|
|
/* https://godotengine.org */
|
|
|
|
/**************************************************************************/
|
|
|
|
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
|
|
|
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/**************************************************************************/
|
2018-01-05 00:50:27 +01:00
|
|
|
|
2021-10-18 21:24:30 +02:00
|
|
|
#include "godot_area_3d.h"
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2021-10-18 21:24:30 +02:00
|
|
|
#include "godot_body_3d.h"
|
|
|
|
#include "godot_soft_body_3d.h"
|
|
|
|
#include "godot_space_3d.h"
|
|
|
|
|
|
|
|
GodotArea3D::BodyKey::BodyKey(GodotSoftBody3D *p_body, uint32_t p_body_shape, uint32_t p_area_shape) {
|
2021-07-20 06:23:32 +02:00
|
|
|
rid = p_body->get_self();
|
|
|
|
instance_id = p_body->get_instance_id();
|
|
|
|
body_shape = p_body_shape;
|
|
|
|
area_shape = p_area_shape;
|
|
|
|
}
|
|
|
|
|
2021-10-18 21:24:30 +02:00
|
|
|
GodotArea3D::BodyKey::BodyKey(GodotBody3D *p_body, uint32_t p_body_shape, uint32_t p_area_shape) {
|
2014-02-10 02:10:30 +01:00
|
|
|
rid = p_body->get_self();
|
|
|
|
instance_id = p_body->get_instance_id();
|
|
|
|
body_shape = p_body_shape;
|
|
|
|
area_shape = p_area_shape;
|
|
|
|
}
|
2020-05-14 14:29:06 +02:00
|
|
|
|
2021-10-18 21:24:30 +02:00
|
|
|
GodotArea3D::BodyKey::BodyKey(GodotArea3D *p_body, uint32_t p_body_shape, uint32_t p_area_shape) {
|
2015-06-12 20:52:21 +02:00
|
|
|
rid = p_body->get_self();
|
|
|
|
instance_id = p_body->get_instance_id();
|
|
|
|
body_shape = p_body_shape;
|
|
|
|
area_shape = p_area_shape;
|
|
|
|
}
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2021-10-18 21:24:30 +02:00
|
|
|
void GodotArea3D::_shapes_changed() {
|
2020-05-14 16:41:43 +02:00
|
|
|
if (!moved_list.in_list() && get_space()) {
|
2019-11-14 08:48:41 +01:00
|
|
|
get_space()->area_add_to_moved_list(&moved_list);
|
2020-05-14 16:41:43 +02:00
|
|
|
}
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
|
|
|
|
2021-10-18 21:24:30 +02:00
|
|
|
void GodotArea3D::set_transform(const Transform3D &p_transform) {
|
2020-05-14 16:41:43 +02:00
|
|
|
if (!moved_list.in_list() && get_space()) {
|
2014-02-10 02:10:30 +01:00
|
|
|
get_space()->area_add_to_moved_list(&moved_list);
|
2020-05-14 16:41:43 +02:00
|
|
|
}
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
_set_transform(p_transform);
|
2014-09-15 16:33:30 +02:00
|
|
|
_set_inv_transform(p_transform.affine_inverse());
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
|
|
|
|
2021-10-18 21:24:30 +02:00
|
|
|
void GodotArea3D::set_space(GodotSpace3D *p_space) {
|
2014-02-10 02:10:30 +01:00
|
|
|
if (get_space()) {
|
2020-05-14 16:41:43 +02:00
|
|
|
if (monitor_query_list.in_list()) {
|
2014-02-10 02:10:30 +01:00
|
|
|
get_space()->area_remove_from_monitor_query_list(&monitor_query_list);
|
2020-05-14 16:41:43 +02:00
|
|
|
}
|
|
|
|
if (moved_list.in_list()) {
|
2014-02-10 02:10:30 +01:00
|
|
|
get_space()->area_remove_from_moved_list(&moved_list);
|
2020-05-14 16:41:43 +02:00
|
|
|
}
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
monitored_bodies.clear();
|
2015-06-12 20:52:21 +02:00
|
|
|
monitored_areas.clear();
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
_set_space(p_space);
|
|
|
|
}
|
|
|
|
|
2021-10-31 22:45:58 +01:00
|
|
|
void GodotArea3D::set_monitor_callback(const Callable &p_callback) {
|
2014-02-10 02:10:30 +01:00
|
|
|
_unregister_shapes();
|
|
|
|
|
2021-10-31 22:45:58 +01:00
|
|
|
monitor_callback = p_callback;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
|
|
|
monitored_bodies.clear();
|
2015-06-12 20:52:21 +02:00
|
|
|
monitored_areas.clear();
|
|
|
|
|
2014-02-10 02:10:30 +01:00
|
|
|
_shape_changed();
|
|
|
|
|
2020-05-14 16:41:43 +02:00
|
|
|
if (!moved_list.in_list() && get_space()) {
|
2015-09-04 04:24:55 +02:00
|
|
|
get_space()->area_add_to_moved_list(&moved_list);
|
2020-05-14 16:41:43 +02:00
|
|
|
}
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
|
|
|
|
2021-10-31 22:45:58 +01:00
|
|
|
void GodotArea3D::set_area_monitor_callback(const Callable &p_callback) {
|
2015-06-12 20:52:21 +02:00
|
|
|
_unregister_shapes();
|
|
|
|
|
2021-10-31 22:45:58 +01:00
|
|
|
area_monitor_callback = p_callback;
|
2015-06-12 20:52:21 +02:00
|
|
|
|
|
|
|
monitored_bodies.clear();
|
|
|
|
monitored_areas.clear();
|
|
|
|
|
|
|
|
_shape_changed();
|
|
|
|
|
2020-05-14 16:41:43 +02:00
|
|
|
if (!moved_list.in_list() && get_space()) {
|
2015-09-04 04:24:55 +02:00
|
|
|
get_space()->area_add_to_moved_list(&moved_list);
|
2020-05-14 16:41:43 +02:00
|
|
|
}
|
2015-06-12 20:52:21 +02:00
|
|
|
}
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2021-11-05 02:12:00 +01:00
|
|
|
void GodotArea3D::_set_space_override_mode(PhysicsServer3D::AreaSpaceOverrideMode &r_mode, PhysicsServer3D::AreaSpaceOverrideMode p_new_mode) {
|
|
|
|
bool do_override = p_new_mode != PhysicsServer3D::AREA_SPACE_OVERRIDE_DISABLED;
|
|
|
|
if (do_override == (r_mode != PhysicsServer3D::AREA_SPACE_OVERRIDE_DISABLED)) {
|
2014-02-10 02:10:30 +01:00
|
|
|
return;
|
2020-05-14 16:41:43 +02:00
|
|
|
}
|
2014-02-10 02:10:30 +01:00
|
|
|
_unregister_shapes();
|
2021-11-05 02:12:00 +01:00
|
|
|
r_mode = p_new_mode;
|
2014-02-10 02:10:30 +01:00
|
|
|
_shape_changed();
|
|
|
|
}
|
|
|
|
|
2021-10-18 21:24:30 +02:00
|
|
|
void GodotArea3D::set_param(PhysicsServer3D::AreaParameter p_param, const Variant &p_value) {
|
2014-02-10 02:10:30 +01:00
|
|
|
switch (p_param) {
|
2021-11-05 02:12:00 +01:00
|
|
|
case PhysicsServer3D::AREA_PARAM_GRAVITY_OVERRIDE_MODE:
|
|
|
|
_set_space_override_mode(gravity_override_mode, (PhysicsServer3D::AreaSpaceOverrideMode)(int)p_value);
|
|
|
|
break;
|
2020-05-10 13:00:47 +02:00
|
|
|
case PhysicsServer3D::AREA_PARAM_GRAVITY:
|
|
|
|
gravity = p_value;
|
|
|
|
break;
|
|
|
|
case PhysicsServer3D::AREA_PARAM_GRAVITY_VECTOR:
|
|
|
|
gravity_vector = p_value;
|
|
|
|
break;
|
|
|
|
case PhysicsServer3D::AREA_PARAM_GRAVITY_IS_POINT:
|
|
|
|
gravity_is_point = p_value;
|
|
|
|
break;
|
2023-01-30 01:11:41 +01:00
|
|
|
case PhysicsServer3D::AREA_PARAM_GRAVITY_POINT_UNIT_DISTANCE:
|
|
|
|
gravity_point_unit_distance = p_value;
|
2020-05-10 13:00:47 +02:00
|
|
|
break;
|
2021-11-05 02:12:00 +01:00
|
|
|
case PhysicsServer3D::AREA_PARAM_LINEAR_DAMP_OVERRIDE_MODE:
|
|
|
|
_set_space_override_mode(linear_damping_override_mode, (PhysicsServer3D::AreaSpaceOverrideMode)(int)p_value);
|
|
|
|
break;
|
2020-05-10 13:00:47 +02:00
|
|
|
case PhysicsServer3D::AREA_PARAM_LINEAR_DAMP:
|
|
|
|
linear_damp = p_value;
|
|
|
|
break;
|
2021-11-05 02:12:00 +01:00
|
|
|
case PhysicsServer3D::AREA_PARAM_ANGULAR_DAMP_OVERRIDE_MODE:
|
|
|
|
_set_space_override_mode(angular_damping_override_mode, (PhysicsServer3D::AreaSpaceOverrideMode)(int)p_value);
|
|
|
|
break;
|
2020-05-10 13:00:47 +02:00
|
|
|
case PhysicsServer3D::AREA_PARAM_ANGULAR_DAMP:
|
|
|
|
angular_damp = p_value;
|
|
|
|
break;
|
|
|
|
case PhysicsServer3D::AREA_PARAM_PRIORITY:
|
|
|
|
priority = p_value;
|
|
|
|
break;
|
2021-07-20 06:23:32 +02:00
|
|
|
case PhysicsServer3D::AREA_PARAM_WIND_FORCE_MAGNITUDE:
|
|
|
|
ERR_FAIL_COND_MSG(wind_force_magnitude < 0, "Wind force magnitude must be a non-negative real number, but a negative number was specified.");
|
|
|
|
wind_force_magnitude = p_value;
|
|
|
|
break;
|
|
|
|
case PhysicsServer3D::AREA_PARAM_WIND_SOURCE:
|
|
|
|
wind_source = p_value;
|
|
|
|
break;
|
|
|
|
case PhysicsServer3D::AREA_PARAM_WIND_DIRECTION:
|
|
|
|
wind_direction = p_value;
|
|
|
|
break;
|
|
|
|
case PhysicsServer3D::AREA_PARAM_WIND_ATTENUATION_FACTOR:
|
|
|
|
ERR_FAIL_COND_MSG(wind_attenuation_factor < 0, "Wind attenuation factor must be a non-negative real number, but a negative number was specified.");
|
|
|
|
wind_attenuation_factor = p_value;
|
|
|
|
break;
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-18 21:24:30 +02:00
|
|
|
Variant GodotArea3D::get_param(PhysicsServer3D::AreaParameter p_param) const {
|
2014-02-10 02:10:30 +01:00
|
|
|
switch (p_param) {
|
2021-11-05 02:12:00 +01:00
|
|
|
case PhysicsServer3D::AREA_PARAM_GRAVITY_OVERRIDE_MODE:
|
|
|
|
return gravity_override_mode;
|
2020-05-10 13:00:47 +02:00
|
|
|
case PhysicsServer3D::AREA_PARAM_GRAVITY:
|
|
|
|
return gravity;
|
|
|
|
case PhysicsServer3D::AREA_PARAM_GRAVITY_VECTOR:
|
|
|
|
return gravity_vector;
|
|
|
|
case PhysicsServer3D::AREA_PARAM_GRAVITY_IS_POINT:
|
|
|
|
return gravity_is_point;
|
2023-01-30 01:11:41 +01:00
|
|
|
case PhysicsServer3D::AREA_PARAM_GRAVITY_POINT_UNIT_DISTANCE:
|
|
|
|
return gravity_point_unit_distance;
|
2021-11-05 02:12:00 +01:00
|
|
|
case PhysicsServer3D::AREA_PARAM_LINEAR_DAMP_OVERRIDE_MODE:
|
|
|
|
return linear_damping_override_mode;
|
2020-05-10 13:00:47 +02:00
|
|
|
case PhysicsServer3D::AREA_PARAM_LINEAR_DAMP:
|
|
|
|
return linear_damp;
|
2021-11-05 02:12:00 +01:00
|
|
|
case PhysicsServer3D::AREA_PARAM_ANGULAR_DAMP_OVERRIDE_MODE:
|
|
|
|
return angular_damping_override_mode;
|
2020-05-10 13:00:47 +02:00
|
|
|
case PhysicsServer3D::AREA_PARAM_ANGULAR_DAMP:
|
|
|
|
return angular_damp;
|
|
|
|
case PhysicsServer3D::AREA_PARAM_PRIORITY:
|
|
|
|
return priority;
|
2021-07-20 06:23:32 +02:00
|
|
|
case PhysicsServer3D::AREA_PARAM_WIND_FORCE_MAGNITUDE:
|
|
|
|
return wind_force_magnitude;
|
|
|
|
case PhysicsServer3D::AREA_PARAM_WIND_SOURCE:
|
|
|
|
return wind_source;
|
|
|
|
case PhysicsServer3D::AREA_PARAM_WIND_DIRECTION:
|
|
|
|
return wind_direction;
|
|
|
|
case PhysicsServer3D::AREA_PARAM_WIND_ATTENUATION_FACTOR:
|
|
|
|
return wind_attenuation_factor;
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return Variant();
|
|
|
|
}
|
|
|
|
|
2021-10-18 21:24:30 +02:00
|
|
|
void GodotArea3D::_queue_monitor_update() {
|
2023-09-28 11:40:18 +02:00
|
|
|
ERR_FAIL_NULL(get_space());
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2020-05-14 16:41:43 +02:00
|
|
|
if (!monitor_query_list.in_list()) {
|
2014-02-10 02:10:30 +01:00
|
|
|
get_space()->area_add_to_monitor_query_list(&monitor_query_list);
|
2020-05-14 16:41:43 +02:00
|
|
|
}
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
|
|
|
|
2021-10-18 21:24:30 +02:00
|
|
|
void GodotArea3D::set_monitorable(bool p_monitorable) {
|
2020-05-14 16:41:43 +02:00
|
|
|
if (monitorable == p_monitorable) {
|
2015-06-12 20:52:21 +02:00
|
|
|
return;
|
2020-05-14 16:41:43 +02:00
|
|
|
}
|
2015-06-12 20:52:21 +02:00
|
|
|
|
|
|
|
monitorable = p_monitorable;
|
|
|
|
_set_static(!monitorable);
|
2021-11-20 07:57:34 +01:00
|
|
|
_shapes_changed();
|
2015-06-12 20:52:21 +02:00
|
|
|
}
|
|
|
|
|
2021-10-18 21:24:30 +02:00
|
|
|
void GodotArea3D::call_queries() {
|
2021-10-31 22:45:58 +01:00
|
|
|
if (!monitor_callback.is_null() && !monitored_bodies.is_empty()) {
|
|
|
|
if (monitor_callback.is_valid()) {
|
|
|
|
Variant res[5];
|
|
|
|
Variant *resptr[5];
|
|
|
|
for (int i = 0; i < 5; i++) {
|
|
|
|
resptr[i] = &res[i];
|
|
|
|
}
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2022-05-13 15:04:37 +02:00
|
|
|
for (HashMap<BodyKey, BodyState, BodyKey>::Iterator E = monitored_bodies.begin(); E;) {
|
|
|
|
if (E->value.state == 0) { // Nothing happened
|
|
|
|
HashMap<BodyKey, BodyState, BodyKey>::Iterator next = E;
|
|
|
|
++next;
|
|
|
|
monitored_bodies.remove(E);
|
2021-10-31 22:45:58 +01:00
|
|
|
E = next;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2022-05-13 15:04:37 +02:00
|
|
|
res[0] = E->value.state > 0 ? PhysicsServer3D::AREA_BODY_ADDED : PhysicsServer3D::AREA_BODY_REMOVED;
|
|
|
|
res[1] = E->key.rid;
|
|
|
|
res[2] = E->key.instance_id;
|
|
|
|
res[3] = E->key.body_shape;
|
|
|
|
res[4] = E->key.area_shape;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2022-05-13 15:04:37 +02:00
|
|
|
HashMap<BodyKey, BodyState, BodyKey>::Iterator next = E;
|
|
|
|
++next;
|
|
|
|
monitored_bodies.remove(E);
|
2020-12-26 10:27:42 +01:00
|
|
|
E = next;
|
2014-02-10 02:10:30 +01:00
|
|
|
|
2021-10-31 22:45:58 +01:00
|
|
|
Callable::CallError ce;
|
|
|
|
Variant ret;
|
2022-07-28 22:56:41 +02:00
|
|
|
monitor_callback.callp((const Variant **)resptr, 5, ret, ce);
|
2022-08-07 22:43:44 +02:00
|
|
|
|
|
|
|
if (ce.error != Callable::CallError::CALL_OK) {
|
|
|
|
ERR_PRINT_ONCE("Error calling monitor callback method " + Variant::get_callable_error_text(monitor_callback, (const Variant **)resptr, 5, ce));
|
|
|
|
}
|
2021-10-31 22:45:58 +01:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
monitored_bodies.clear();
|
|
|
|
monitor_callback = Callable();
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-31 22:45:58 +01:00
|
|
|
if (!area_monitor_callback.is_null() && !monitored_areas.is_empty()) {
|
|
|
|
if (area_monitor_callback.is_valid()) {
|
|
|
|
Variant res[5];
|
|
|
|
Variant *resptr[5];
|
|
|
|
for (int i = 0; i < 5; i++) {
|
|
|
|
resptr[i] = &res[i];
|
|
|
|
}
|
2015-06-12 20:52:21 +02:00
|
|
|
|
2022-05-13 15:04:37 +02:00
|
|
|
for (HashMap<BodyKey, BodyState, BodyKey>::Iterator E = monitored_areas.begin(); E;) {
|
|
|
|
if (E->value.state == 0) { // Nothing happened
|
|
|
|
HashMap<BodyKey, BodyState, BodyKey>::Iterator next = E;
|
|
|
|
++next;
|
|
|
|
monitored_areas.remove(E);
|
2021-10-31 22:45:58 +01:00
|
|
|
E = next;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2022-05-13 15:04:37 +02:00
|
|
|
res[0] = E->value.state > 0 ? PhysicsServer3D::AREA_BODY_ADDED : PhysicsServer3D::AREA_BODY_REMOVED;
|
|
|
|
res[1] = E->key.rid;
|
|
|
|
res[2] = E->key.instance_id;
|
|
|
|
res[3] = E->key.body_shape;
|
|
|
|
res[4] = E->key.area_shape;
|
2015-06-12 20:52:21 +02:00
|
|
|
|
2022-05-13 15:04:37 +02:00
|
|
|
HashMap<BodyKey, BodyState, BodyKey>::Iterator next = E;
|
|
|
|
++next;
|
|
|
|
monitored_areas.remove(E);
|
2020-12-26 10:27:42 +01:00
|
|
|
E = next;
|
2015-06-12 20:52:21 +02:00
|
|
|
|
2021-10-31 22:45:58 +01:00
|
|
|
Callable::CallError ce;
|
|
|
|
Variant ret;
|
2022-07-28 22:56:41 +02:00
|
|
|
area_monitor_callback.callp((const Variant **)resptr, 5, ret, ce);
|
2022-08-07 22:43:44 +02:00
|
|
|
|
|
|
|
if (ce.error != Callable::CallError::CALL_OK) {
|
|
|
|
ERR_PRINT_ONCE("Error calling area monitor callback method " + Variant::get_callable_error_text(area_monitor_callback, (const Variant **)resptr, 5, ce));
|
|
|
|
}
|
2021-10-31 22:45:58 +01:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
monitored_areas.clear();
|
|
|
|
area_monitor_callback = Callable();
|
2015-06-12 20:52:21 +02:00
|
|
|
}
|
|
|
|
}
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
|
|
|
|
2021-10-18 21:24:30 +02:00
|
|
|
void GodotArea3D::compute_gravity(const Vector3 &p_position, Vector3 &r_gravity) const {
|
2021-08-24 18:30:31 +02:00
|
|
|
if (is_gravity_point()) {
|
2023-01-30 01:11:41 +01:00
|
|
|
const real_t gr_unit_dist = get_gravity_point_unit_distance();
|
2021-08-24 18:30:31 +02:00
|
|
|
Vector3 v = get_transform().xform(get_gravity_vector()) - p_position;
|
2023-01-30 01:11:41 +01:00
|
|
|
if (gr_unit_dist > 0) {
|
|
|
|
const real_t v_length_sq = v.length_squared();
|
|
|
|
if (v_length_sq > 0) {
|
|
|
|
const real_t gravity_strength = get_gravity() * gr_unit_dist * gr_unit_dist / v_length_sq;
|
|
|
|
r_gravity = v.normalized() * gravity_strength;
|
2021-08-24 18:30:31 +02:00
|
|
|
} else {
|
|
|
|
r_gravity = Vector3();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
r_gravity = v.normalized() * get_gravity();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
r_gravity = get_gravity_vector() * get_gravity();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-18 21:24:30 +02:00
|
|
|
GodotArea3D::GodotArea3D() :
|
|
|
|
GodotCollisionObject3D(TYPE_AREA),
|
2017-12-06 21:36:34 +01:00
|
|
|
monitor_query_list(this),
|
|
|
|
moved_list(this) {
|
2014-02-10 02:10:30 +01:00
|
|
|
_set_static(true); //areas are never active
|
2014-10-03 05:10:51 +02:00
|
|
|
set_ray_pickable(false);
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|
|
|
|
|
2021-10-18 21:24:30 +02:00
|
|
|
GodotArea3D::~GodotArea3D() {
|
2014-02-10 02:10:30 +01:00
|
|
|
}
|