collision_object.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537
  1. /*************************************************************************/
  2. /* collision_object.cpp */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
  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 "collision_object.h"
  31. #include "core/engine.h"
  32. #include "mesh_instance.h"
  33. #include "scene/scene_string_names.h"
  34. #include "servers/physics_server.h"
  35. void CollisionObject::_notification(int p_what) {
  36. switch (p_what) {
  37. case NOTIFICATION_ENTER_TREE: {
  38. if (_are_collision_shapes_visible()) {
  39. debug_shape_old_transform = get_global_transform();
  40. for (Map<uint32_t, ShapeData>::Element *E = shapes.front(); E; E = E->next()) {
  41. debug_shapes_to_update.insert(E->key());
  42. }
  43. _update_debug_shapes();
  44. }
  45. } break;
  46. case NOTIFICATION_EXIT_TREE: {
  47. if (debug_shapes_count > 0) {
  48. _clear_debug_shapes();
  49. }
  50. } break;
  51. case NOTIFICATION_ENTER_WORLD: {
  52. if (area)
  53. PhysicsServer::get_singleton()->area_set_transform(rid, get_global_transform());
  54. else
  55. PhysicsServer::get_singleton()->body_set_state(rid, PhysicsServer::BODY_STATE_TRANSFORM, get_global_transform());
  56. RID space = get_world()->get_space();
  57. if (area) {
  58. PhysicsServer::get_singleton()->area_set_space(rid, space);
  59. } else
  60. PhysicsServer::get_singleton()->body_set_space(rid, space);
  61. _update_pickable();
  62. //get space
  63. } break;
  64. case NOTIFICATION_TRANSFORM_CHANGED: {
  65. if (area)
  66. PhysicsServer::get_singleton()->area_set_transform(rid, get_global_transform());
  67. else
  68. PhysicsServer::get_singleton()->body_set_state(rid, PhysicsServer::BODY_STATE_TRANSFORM, get_global_transform());
  69. _on_transform_changed();
  70. } break;
  71. case NOTIFICATION_VISIBILITY_CHANGED: {
  72. _update_pickable();
  73. } break;
  74. case NOTIFICATION_EXIT_WORLD: {
  75. if (area) {
  76. PhysicsServer::get_singleton()->area_set_space(rid, RID());
  77. } else
  78. PhysicsServer::get_singleton()->body_set_space(rid, RID());
  79. } break;
  80. }
  81. }
  82. void CollisionObject::_input_event(Node *p_camera, const Ref<InputEvent> &p_input_event, const Vector3 &p_pos, const Vector3 &p_normal, int p_shape) {
  83. if (get_script_instance()) {
  84. get_script_instance()->call(SceneStringNames::get_singleton()->_input_event, p_camera, p_input_event, p_pos, p_normal, p_shape);
  85. }
  86. emit_signal(SceneStringNames::get_singleton()->input_event, p_camera, p_input_event, p_pos, p_normal, p_shape);
  87. }
  88. void CollisionObject::_mouse_enter() {
  89. if (get_script_instance()) {
  90. get_script_instance()->call(SceneStringNames::get_singleton()->_mouse_enter);
  91. }
  92. emit_signal(SceneStringNames::get_singleton()->mouse_entered);
  93. }
  94. void CollisionObject::_mouse_exit() {
  95. if (get_script_instance()) {
  96. get_script_instance()->call(SceneStringNames::get_singleton()->_mouse_exit);
  97. }
  98. emit_signal(SceneStringNames::get_singleton()->mouse_exited);
  99. }
  100. void CollisionObject::_update_pickable() {
  101. if (!is_inside_tree())
  102. return;
  103. bool pickable = ray_pickable && is_visible_in_tree();
  104. if (area)
  105. PhysicsServer::get_singleton()->area_set_ray_pickable(rid, pickable);
  106. else
  107. PhysicsServer::get_singleton()->body_set_ray_pickable(rid, pickable);
  108. }
  109. bool CollisionObject::_are_collision_shapes_visible() {
  110. return is_inside_tree() && get_tree()->is_debugging_collisions_hint() && !Engine::get_singleton()->is_editor_hint();
  111. }
  112. void CollisionObject::_update_shape_data(uint32_t p_owner) {
  113. if (_are_collision_shapes_visible()) {
  114. if (debug_shapes_to_update.empty()) {
  115. call_deferred("_update_debug_shapes");
  116. }
  117. debug_shapes_to_update.insert(p_owner);
  118. }
  119. }
  120. void CollisionObject::_shape_changed(const Ref<Shape> &p_shape) {
  121. for (Map<uint32_t, ShapeData>::Element *E = shapes.front(); E; E = E->next()) {
  122. ShapeData &shapedata = E->get();
  123. ShapeData::ShapeBase *shapes = shapedata.shapes.ptrw();
  124. for (int i = 0; i < shapedata.shapes.size(); i++) {
  125. ShapeData::ShapeBase &s = shapes[i];
  126. if (s.shape == p_shape && s.debug_shape.is_valid()) {
  127. Ref<Mesh> mesh = s.shape->get_debug_mesh();
  128. VS::get_singleton()->instance_set_base(s.debug_shape, mesh->get_rid());
  129. }
  130. }
  131. }
  132. }
  133. void CollisionObject::_update_debug_shapes() {
  134. if (!is_inside_tree()) {
  135. debug_shapes_to_update.clear();
  136. return;
  137. }
  138. for (Set<uint32_t>::Element *shapedata_idx = debug_shapes_to_update.front(); shapedata_idx; shapedata_idx = shapedata_idx->next()) {
  139. if (shapes.has(shapedata_idx->get())) {
  140. ShapeData &shapedata = shapes[shapedata_idx->get()];
  141. ShapeData::ShapeBase *shapes = shapedata.shapes.ptrw();
  142. for (int i = 0; i < shapedata.shapes.size(); i++) {
  143. ShapeData::ShapeBase &s = shapes[i];
  144. if (s.shape.is_null() || shapedata.disabled) {
  145. if (s.debug_shape.is_valid()) {
  146. VS::get_singleton()->free(s.debug_shape);
  147. s.debug_shape = RID();
  148. --debug_shapes_count;
  149. }
  150. }
  151. if (!s.debug_shape.is_valid()) {
  152. s.debug_shape = VS::get_singleton()->instance_create();
  153. VS::get_singleton()->instance_set_scenario(s.debug_shape, get_world()->get_scenario());
  154. if (!s.shape->is_connected("changed", this, "_shape_changed")) {
  155. s.shape->connect("changed", this, "_shape_changed", varray(s.shape), CONNECT_DEFERRED);
  156. }
  157. ++debug_shapes_count;
  158. }
  159. Ref<Mesh> mesh = s.shape->get_debug_mesh();
  160. VS::get_singleton()->instance_set_base(s.debug_shape, mesh->get_rid());
  161. VS::get_singleton()->instance_set_transform(s.debug_shape, get_global_transform() * shapedata.xform);
  162. }
  163. }
  164. }
  165. debug_shapes_to_update.clear();
  166. }
  167. void CollisionObject::_clear_debug_shapes() {
  168. for (Map<uint32_t, ShapeData>::Element *E = shapes.front(); E; E = E->next()) {
  169. ShapeData &shapedata = E->get();
  170. ShapeData::ShapeBase *shapes = shapedata.shapes.ptrw();
  171. for (int i = 0; i < shapedata.shapes.size(); i++) {
  172. ShapeData::ShapeBase &s = shapes[i];
  173. if (s.debug_shape.is_valid()) {
  174. VS::get_singleton()->free(s.debug_shape);
  175. s.debug_shape = RID();
  176. if (s.shape.is_valid() && s.shape->is_connected("changed", this, "_shape_changed")) {
  177. s.shape->disconnect("changed", this, "_shape_changed");
  178. }
  179. }
  180. }
  181. }
  182. debug_shapes_count = 0;
  183. }
  184. void CollisionObject::_on_transform_changed() {
  185. if (debug_shapes_count > 0 && !debug_shape_old_transform.is_equal_approx(get_global_transform())) {
  186. debug_shape_old_transform = get_global_transform();
  187. for (Map<uint32_t, ShapeData>::Element *E = shapes.front(); E; E = E->next()) {
  188. ShapeData &shapedata = E->get();
  189. const ShapeData::ShapeBase *shapes = shapedata.shapes.ptr();
  190. for (int i = 0; i < shapedata.shapes.size(); i++) {
  191. VS::get_singleton()->instance_set_transform(shapes[i].debug_shape, debug_shape_old_transform * shapedata.xform);
  192. }
  193. }
  194. }
  195. }
  196. void CollisionObject::set_ray_pickable(bool p_ray_pickable) {
  197. ray_pickable = p_ray_pickable;
  198. _update_pickable();
  199. }
  200. bool CollisionObject::is_ray_pickable() const {
  201. return ray_pickable;
  202. }
  203. void CollisionObject::_bind_methods() {
  204. ClassDB::bind_method(D_METHOD("set_ray_pickable", "ray_pickable"), &CollisionObject::set_ray_pickable);
  205. ClassDB::bind_method(D_METHOD("is_ray_pickable"), &CollisionObject::is_ray_pickable);
  206. ClassDB::bind_method(D_METHOD("set_capture_input_on_drag", "enable"), &CollisionObject::set_capture_input_on_drag);
  207. ClassDB::bind_method(D_METHOD("get_capture_input_on_drag"), &CollisionObject::get_capture_input_on_drag);
  208. ClassDB::bind_method(D_METHOD("get_rid"), &CollisionObject::get_rid);
  209. ClassDB::bind_method(D_METHOD("create_shape_owner", "owner"), &CollisionObject::create_shape_owner);
  210. ClassDB::bind_method(D_METHOD("remove_shape_owner", "owner_id"), &CollisionObject::remove_shape_owner);
  211. ClassDB::bind_method(D_METHOD("get_shape_owners"), &CollisionObject::_get_shape_owners);
  212. ClassDB::bind_method(D_METHOD("shape_owner_set_transform", "owner_id", "transform"), &CollisionObject::shape_owner_set_transform);
  213. ClassDB::bind_method(D_METHOD("shape_owner_get_transform", "owner_id"), &CollisionObject::shape_owner_get_transform);
  214. ClassDB::bind_method(D_METHOD("shape_owner_get_owner", "owner_id"), &CollisionObject::shape_owner_get_owner);
  215. ClassDB::bind_method(D_METHOD("shape_owner_set_disabled", "owner_id", "disabled"), &CollisionObject::shape_owner_set_disabled);
  216. ClassDB::bind_method(D_METHOD("is_shape_owner_disabled", "owner_id"), &CollisionObject::is_shape_owner_disabled);
  217. ClassDB::bind_method(D_METHOD("shape_owner_add_shape", "owner_id", "shape"), &CollisionObject::shape_owner_add_shape);
  218. ClassDB::bind_method(D_METHOD("shape_owner_get_shape_count", "owner_id"), &CollisionObject::shape_owner_get_shape_count);
  219. ClassDB::bind_method(D_METHOD("shape_owner_get_shape", "owner_id", "shape_id"), &CollisionObject::shape_owner_get_shape);
  220. ClassDB::bind_method(D_METHOD("shape_owner_get_shape_index", "owner_id", "shape_id"), &CollisionObject::shape_owner_get_shape_index);
  221. ClassDB::bind_method(D_METHOD("shape_owner_remove_shape", "owner_id", "shape_id"), &CollisionObject::shape_owner_remove_shape);
  222. ClassDB::bind_method(D_METHOD("shape_owner_clear_shapes", "owner_id"), &CollisionObject::shape_owner_clear_shapes);
  223. ClassDB::bind_method(D_METHOD("shape_find_owner", "shape_index"), &CollisionObject::shape_find_owner);
  224. ClassDB::bind_method(D_METHOD("_update_debug_shapes"), &CollisionObject::_update_debug_shapes);
  225. ClassDB::bind_method(D_METHOD("_shape_changed", "shape"), &CollisionObject::_shape_changed);
  226. BIND_VMETHOD(MethodInfo("_input_event", PropertyInfo(Variant::OBJECT, "camera"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"), PropertyInfo(Variant::VECTOR3, "click_position"), PropertyInfo(Variant::VECTOR3, "click_normal"), PropertyInfo(Variant::INT, "shape_idx")));
  227. ADD_SIGNAL(MethodInfo("input_event", PropertyInfo(Variant::OBJECT, "camera", PROPERTY_HINT_RESOURCE_TYPE, "Node"), PropertyInfo(Variant::OBJECT, "event", PROPERTY_HINT_RESOURCE_TYPE, "InputEvent"), PropertyInfo(Variant::VECTOR3, "click_position"), PropertyInfo(Variant::VECTOR3, "click_normal"), PropertyInfo(Variant::INT, "shape_idx")));
  228. ADD_SIGNAL(MethodInfo("mouse_entered"));
  229. ADD_SIGNAL(MethodInfo("mouse_exited"));
  230. ADD_PROPERTY(PropertyInfo(Variant::BOOL, "input_ray_pickable"), "set_ray_pickable", "is_ray_pickable");
  231. ADD_PROPERTY(PropertyInfo(Variant::BOOL, "input_capture_on_drag"), "set_capture_input_on_drag", "get_capture_input_on_drag");
  232. }
  233. uint32_t CollisionObject::create_shape_owner(Object *p_owner) {
  234. ShapeData sd;
  235. uint32_t id;
  236. if (shapes.size() == 0) {
  237. id = 0;
  238. } else {
  239. id = shapes.back()->key() + 1;
  240. }
  241. sd.owner = p_owner;
  242. shapes[id] = sd;
  243. return id;
  244. }
  245. void CollisionObject::remove_shape_owner(uint32_t owner) {
  246. ERR_FAIL_COND(!shapes.has(owner));
  247. shape_owner_clear_shapes(owner);
  248. shapes.erase(owner);
  249. }
  250. void CollisionObject::shape_owner_set_disabled(uint32_t p_owner, bool p_disabled) {
  251. ERR_FAIL_COND(!shapes.has(p_owner));
  252. ShapeData &sd = shapes[p_owner];
  253. if (sd.disabled == p_disabled) {
  254. return;
  255. }
  256. sd.disabled = p_disabled;
  257. for (int i = 0; i < sd.shapes.size(); i++) {
  258. if (area) {
  259. PhysicsServer::get_singleton()->area_set_shape_disabled(rid, sd.shapes[i].index, p_disabled);
  260. } else {
  261. PhysicsServer::get_singleton()->body_set_shape_disabled(rid, sd.shapes[i].index, p_disabled);
  262. }
  263. }
  264. _update_shape_data(p_owner);
  265. }
  266. bool CollisionObject::is_shape_owner_disabled(uint32_t p_owner) const {
  267. ERR_FAIL_COND_V(!shapes.has(p_owner), false);
  268. return shapes[p_owner].disabled;
  269. }
  270. void CollisionObject::get_shape_owners(List<uint32_t> *r_owners) {
  271. for (Map<uint32_t, ShapeData>::Element *E = shapes.front(); E; E = E->next()) {
  272. r_owners->push_back(E->key());
  273. }
  274. }
  275. Array CollisionObject::_get_shape_owners() {
  276. Array ret;
  277. for (Map<uint32_t, ShapeData>::Element *E = shapes.front(); E; E = E->next()) {
  278. ret.push_back(E->key());
  279. }
  280. return ret;
  281. }
  282. void CollisionObject::shape_owner_set_transform(uint32_t p_owner, const Transform &p_transform) {
  283. ERR_FAIL_COND(!shapes.has(p_owner));
  284. ShapeData &sd = shapes[p_owner];
  285. sd.xform = p_transform;
  286. for (int i = 0; i < sd.shapes.size(); i++) {
  287. if (area) {
  288. PhysicsServer::get_singleton()->area_set_shape_transform(rid, sd.shapes[i].index, p_transform);
  289. } else {
  290. PhysicsServer::get_singleton()->body_set_shape_transform(rid, sd.shapes[i].index, p_transform);
  291. }
  292. }
  293. _update_shape_data(p_owner);
  294. }
  295. Transform CollisionObject::shape_owner_get_transform(uint32_t p_owner) const {
  296. ERR_FAIL_COND_V(!shapes.has(p_owner), Transform());
  297. return shapes[p_owner].xform;
  298. }
  299. Object *CollisionObject::shape_owner_get_owner(uint32_t p_owner) const {
  300. ERR_FAIL_COND_V(!shapes.has(p_owner), NULL);
  301. return shapes[p_owner].owner;
  302. }
  303. void CollisionObject::shape_owner_add_shape(uint32_t p_owner, const Ref<Shape> &p_shape) {
  304. ERR_FAIL_COND(!shapes.has(p_owner));
  305. ERR_FAIL_COND(p_shape.is_null());
  306. ShapeData &sd = shapes[p_owner];
  307. ShapeData::ShapeBase s;
  308. s.index = total_subshapes;
  309. s.shape = p_shape;
  310. if (area) {
  311. PhysicsServer::get_singleton()->area_add_shape(rid, p_shape->get_rid(), sd.xform, sd.disabled);
  312. } else {
  313. PhysicsServer::get_singleton()->body_add_shape(rid, p_shape->get_rid(), sd.xform, sd.disabled);
  314. }
  315. sd.shapes.push_back(s);
  316. total_subshapes++;
  317. _update_shape_data(p_owner);
  318. }
  319. int CollisionObject::shape_owner_get_shape_count(uint32_t p_owner) const {
  320. ERR_FAIL_COND_V(!shapes.has(p_owner), 0);
  321. return shapes[p_owner].shapes.size();
  322. }
  323. Ref<Shape> CollisionObject::shape_owner_get_shape(uint32_t p_owner, int p_shape) const {
  324. ERR_FAIL_COND_V(!shapes.has(p_owner), Ref<Shape>());
  325. ERR_FAIL_INDEX_V(p_shape, shapes[p_owner].shapes.size(), Ref<Shape>());
  326. return shapes[p_owner].shapes[p_shape].shape;
  327. }
  328. int CollisionObject::shape_owner_get_shape_index(uint32_t p_owner, int p_shape) const {
  329. ERR_FAIL_COND_V(!shapes.has(p_owner), -1);
  330. ERR_FAIL_INDEX_V(p_shape, shapes[p_owner].shapes.size(), -1);
  331. return shapes[p_owner].shapes[p_shape].index;
  332. }
  333. void CollisionObject::shape_owner_remove_shape(uint32_t p_owner, int p_shape) {
  334. ERR_FAIL_COND(!shapes.has(p_owner));
  335. ERR_FAIL_INDEX(p_shape, shapes[p_owner].shapes.size());
  336. ShapeData::ShapeBase &s = shapes[p_owner].shapes.write[p_shape];
  337. int index_to_remove = s.index;
  338. if (area) {
  339. PhysicsServer::get_singleton()->area_remove_shape(rid, index_to_remove);
  340. } else {
  341. PhysicsServer::get_singleton()->body_remove_shape(rid, index_to_remove);
  342. }
  343. if (s.debug_shape.is_valid()) {
  344. VS::get_singleton()->free(s.debug_shape);
  345. if (s.shape.is_valid() && s.shape->is_connected("changed", this, "_shape_changed")) {
  346. s.shape->disconnect("changed", this, "_shape_changed");
  347. }
  348. --debug_shapes_count;
  349. }
  350. shapes[p_owner].shapes.remove(p_shape);
  351. for (Map<uint32_t, ShapeData>::Element *E = shapes.front(); E; E = E->next()) {
  352. for (int i = 0; i < E->get().shapes.size(); i++) {
  353. if (E->get().shapes[i].index > index_to_remove) {
  354. E->get().shapes.write[i].index -= 1;
  355. }
  356. }
  357. }
  358. total_subshapes--;
  359. }
  360. void CollisionObject::shape_owner_clear_shapes(uint32_t p_owner) {
  361. ERR_FAIL_COND(!shapes.has(p_owner));
  362. while (shape_owner_get_shape_count(p_owner) > 0) {
  363. shape_owner_remove_shape(p_owner, 0);
  364. }
  365. }
  366. uint32_t CollisionObject::shape_find_owner(int p_shape_index) const {
  367. ERR_FAIL_INDEX_V(p_shape_index, total_subshapes, 0);
  368. for (const Map<uint32_t, ShapeData>::Element *E = shapes.front(); E; E = E->next()) {
  369. for (int i = 0; i < E->get().shapes.size(); i++) {
  370. if (E->get().shapes[i].index == p_shape_index) {
  371. return E->key();
  372. }
  373. }
  374. }
  375. //in theory it should be unreachable
  376. return 0;
  377. }
  378. CollisionObject::CollisionObject(RID p_rid, bool p_area) {
  379. rid = p_rid;
  380. area = p_area;
  381. capture_input_on_drag = false;
  382. ray_pickable = true;
  383. set_notify_transform(true);
  384. total_subshapes = 0;
  385. if (p_area) {
  386. PhysicsServer::get_singleton()->area_attach_object_instance_id(rid, get_instance_id());
  387. } else {
  388. PhysicsServer::get_singleton()->body_attach_object_instance_id(rid, get_instance_id());
  389. }
  390. //set_transform_notify(true);
  391. }
  392. void CollisionObject::set_capture_input_on_drag(bool p_capture) {
  393. capture_input_on_drag = p_capture;
  394. }
  395. bool CollisionObject::get_capture_input_on_drag() const {
  396. return capture_input_on_drag;
  397. }
  398. String CollisionObject::get_configuration_warning() const {
  399. String warning = Spatial::get_configuration_warning();
  400. if (shapes.empty()) {
  401. if (!warning.empty()) {
  402. warning += "\n\n";
  403. }
  404. warning += TTR("This node has no shape, so it can't collide or interact with other objects.\nConsider adding a CollisionShape or CollisionPolygon as a child to define its shape.");
  405. }
  406. return warning;
  407. }
  408. CollisionObject::CollisionObject() {
  409. capture_input_on_drag = false;
  410. ray_pickable = true;
  411. set_notify_transform(true);
  412. //owner=
  413. //set_transform_notify(true);
  414. }
  415. CollisionObject::~CollisionObject() {
  416. PhysicsServer::get_singleton()->free(rid);
  417. }