From 9d182e93a3d75396405733109f9f086969c4b19b Mon Sep 17 00:00:00 2001 From: Carl Olsson Date: Fri, 13 Feb 2015 20:49:21 +1000 Subject: Added body mode property to TileMap to select between static and kinematic physics bodies. Kinematic allow use of TileMaps for moving platforms for example. Updated 2D Platformer demo to use kinematic TileMaps for moving platforms, in doing so discovered that the tileset was messed up and not converting properly, so fixed that too. And in order to fix the tileset I need to activate snapping for collision polygon vertices. --- tools/editor/plugins/collision_polygon_editor_plugin.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'tools/editor') diff --git a/tools/editor/plugins/collision_polygon_editor_plugin.cpp b/tools/editor/plugins/collision_polygon_editor_plugin.cpp index b92acb60f9..a6f2085a19 100644 --- a/tools/editor/plugins/collision_polygon_editor_plugin.cpp +++ b/tools/editor/plugins/collision_polygon_editor_plugin.cpp @@ -31,6 +31,8 @@ #include "os/file_access.h" #include "tools/editor/editor_settings.h" #include "scene/3d/camera.h" +#include "canvas_item_editor_plugin.h" + void CollisionPolygonEditor::_notification(int p_what) { switch(p_what) { @@ -71,14 +73,14 @@ void CollisionPolygonEditor::_node_removed(Node *p_node) { Vector2 CollisionPolygonEditor::snap_point(const Vector2& p_point) const { return p_point; - /* - if (canvas_item_editor->is_snap_active()) { + + if (CanvasItemEditor::get_singleton()->is_snap_active()) { - return p_point.snapped(Vector2(1,1)*canvas_item_editor->get_snap()); + return p_point.snapped(Vector2(1,1)*CanvasItemEditor::get_singleton()->get_snap()); } else { return p_point; - } ??? */ + } } void CollisionPolygonEditor::_menu_option(int p_option) { @@ -148,7 +150,7 @@ bool CollisionPolygonEditor::forward_spatial_input_event(Camera* p_camera,const Vector2 cpoint(spoint.x,spoint.y); - //cpoint=snap_point(cpoint); snap? + cpoint=snap_point(cpoint); Vector poly = node->get_polygon(); @@ -362,7 +364,7 @@ bool CollisionPolygonEditor::forward_spatial_input_event(Camera* p_camera,const Vector2 cpoint(spoint.x,spoint.y); - //cpoint=snap_point(cpoint); + cpoint=snap_point(cpoint); edited_point_pos = cpoint; _polygon_draw(); -- cgit v1.2.3