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.
This commit is contained in:
parent
d0ea475405
commit
9d182e93a3
9 changed files with 339 additions and 223 deletions
|
|
@ -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<Vector2> 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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue