diff options
-rw-r--r-- | demos/2d/kinematic_char/player.gd | 3 | ||||
-rw-r--r-- | scene/2d/physics_body_2d.cpp | 10 | ||||
-rw-r--r-- | scene/2d/physics_body_2d.h | 2 | ||||
-rw-r--r-- | scene/2d/tile_map.cpp | 3 | ||||
-rw-r--r-- | scene/3d/camera.cpp | 3 | ||||
-rw-r--r-- | scene/3d/physics_body.h | 1 | ||||
-rw-r--r-- | servers/physics_2d/body_2d_sw.h | 2 | ||||
-rw-r--r-- | servers/physics_2d/collision_object_2d_sw.cpp | 8 | ||||
-rw-r--r-- | servers/physics_2d/collision_object_2d_sw.h | 5 | ||||
-rw-r--r-- | servers/physics_2d/physics_2d_server_sw.cpp | 16 | ||||
-rw-r--r-- | servers/physics_2d/physics_2d_server_sw.h | 4 | ||||
-rw-r--r-- | servers/physics_2d/space_2d_sw.cpp | 4 | ||||
-rw-r--r-- | servers/physics_2d_server.cpp | 6 | ||||
-rw-r--r-- | servers/physics_2d_server.h | 7 | ||||
-rw-r--r-- | tools/editor/plugins/spatial_editor_plugin.cpp | 15 | ||||
-rw-r--r-- | tools/editor/plugins/spatial_editor_plugin.h | 3 |
16 files changed, 86 insertions, 6 deletions
diff --git a/demos/2d/kinematic_char/player.gd b/demos/2d/kinematic_char/player.gd index 5c56477758..9cff0269e8 100644 --- a/demos/2d/kinematic_char/player.gd +++ b/demos/2d/kinematic_char/player.gd @@ -74,6 +74,9 @@ func _fixed_process(delta): var floor_velocity=Vector2() if (is_colliding()): + # you can check which tile was collision against with this + # print(get_collider_metadata()) + #ran against something, is it the floor? get normal var n = get_collision_normal() diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp index 22dbd157b7..308aa8402f 100644 --- a/scene/2d/physics_body_2d.cpp +++ b/scene/2d/physics_body_2d.cpp @@ -926,6 +926,7 @@ Vector2 KinematicBody2D::move(const Vector2& p_motion) { collider=rest_info.collider_id; collider_vel=rest_info.linear_velocity; collider_shape=rest_info.shape; + collider_metadata=rest_info.metadata; } } @@ -1020,6 +1021,14 @@ int KinematicBody2D::get_collider_shape() const { ERR_FAIL_COND_V(!colliding,0); return collider_shape; } + +Variant KinematicBody2D::get_collider_metadata() const { + + ERR_FAIL_COND_V(!colliding,0); + return collider_metadata; + +} + void KinematicBody2D::set_collide_with_static_bodies(bool p_enable) { collide_static=p_enable; @@ -1084,6 +1093,7 @@ void KinematicBody2D::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_collider_velocity"),&KinematicBody2D::get_collider_velocity); ObjectTypeDB::bind_method(_MD("get_collider:Object"),&KinematicBody2D::_get_collider); ObjectTypeDB::bind_method(_MD("get_collider_shape"),&KinematicBody2D::get_collider_shape); + ObjectTypeDB::bind_method(_MD("get_collider_metadata"),&KinematicBody2D::get_collider_metadata); ObjectTypeDB::bind_method(_MD("set_collide_with_static_bodies","enable"),&KinematicBody2D::set_collide_with_static_bodies); diff --git a/scene/2d/physics_body_2d.h b/scene/2d/physics_body_2d.h index 2771aa6aa4..e429ca1432 100644 --- a/scene/2d/physics_body_2d.h +++ b/scene/2d/physics_body_2d.h @@ -255,6 +255,7 @@ class KinematicBody2D : public PhysicsBody2D { Vector2 collider_vel; ObjectID collider; int collider_shape; + Variant collider_metadata; Variant _get_collider() const; @@ -274,6 +275,7 @@ public: Vector2 get_collider_velocity() const; ObjectID get_collider() const; int get_collider_shape() const; + Variant get_collider_metadata() const; void set_collide_with_static_bodies(bool p_enable); bool can_collide_with_static_bodies() const; diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 72ef653d14..eb04ca924f 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -179,6 +179,7 @@ void TileMap::_update_dirty_quadrants() { vs->canvas_item_clear(q.canvas_item); ps->body_clear_shapes(q.static_body); + int shape_idx=0; for(int i=0;i<q.cells.size();i++) { @@ -259,6 +260,8 @@ void TileMap::_update_dirty_quadrants() { ps->body_add_shape(q.static_body,shape->get_rid(),xform); + ps->body_set_shape_metadata(q.static_body,shape_idx++,Vector2(E->key().x,E->key().y)); + } } } diff --git a/scene/3d/camera.cpp b/scene/3d/camera.cpp index 075bb94ea1..93a27f7ac1 100644 --- a/scene/3d/camera.cpp +++ b/scene/3d/camera.cpp @@ -756,7 +756,8 @@ Camera::Camera() { mode=PROJECTION_PERSPECTIVE; set_perspective(60.0,0.1,100.0); keep_aspect=KEEP_HEIGHT; - layers=0xFFFFFFFF; + layers=0xfffff; + VisualServer::get_singleton()->camera_set_visible_layers(camera,layers); //active=false; } diff --git a/scene/3d/physics_body.h b/scene/3d/physics_body.h index 1615fdd1d4..a19ad48c87 100644 --- a/scene/3d/physics_body.h +++ b/scene/3d/physics_body.h @@ -269,6 +269,7 @@ class KinematicBody : public PhysicsBody { int collider_shape; + Variant _get_collider() const; _FORCE_INLINE_ bool _ignores_mode(PhysicsServer::BodyMode) const; diff --git a/servers/physics_2d/body_2d_sw.h b/servers/physics_2d/body_2d_sw.h index 7bf17023ac..789fb1cfee 100644 --- a/servers/physics_2d/body_2d_sw.h +++ b/servers/physics_2d/body_2d_sw.h @@ -336,6 +336,8 @@ public: virtual Vector2 get_contact_collider_pos(int p_contact_idx) const { ERR_FAIL_INDEX_V(p_contact_idx,body->contact_count,Vector2()); return body->contacts[p_contact_idx].collider_pos; } virtual ObjectID get_contact_collider_id(int p_contact_idx) const { ERR_FAIL_INDEX_V(p_contact_idx,body->contact_count,0); return body->contacts[p_contact_idx].collider_instance_id; } virtual int get_contact_collider_shape(int p_contact_idx) const { ERR_FAIL_INDEX_V(p_contact_idx,body->contact_count,0); return body->contacts[p_contact_idx].collider_shape; } + virtual Variant get_contact_collider_shape_metadata(int p_contact_idx) const { ERR_FAIL_INDEX_V(p_contact_idx,body->contact_count,Variant()); return body->get_shape_metadata(body->contacts[p_contact_idx].collider_shape); } + virtual Vector2 get_contact_collider_velocity_at_pos(int p_contact_idx) const { ERR_FAIL_INDEX_V(p_contact_idx,body->contact_count,Vector2()); return body->contacts[p_contact_idx].collider_velocity_at_pos; } virtual Physics2DDirectSpaceState* get_space_state(); diff --git a/servers/physics_2d/collision_object_2d_sw.cpp b/servers/physics_2d/collision_object_2d_sw.cpp index 277a286144..d0443f8110 100644 --- a/servers/physics_2d/collision_object_2d_sw.cpp +++ b/servers/physics_2d/collision_object_2d_sw.cpp @@ -55,6 +55,14 @@ void CollisionObject2DSW::set_shape(int p_index,Shape2DSW *p_shape){ _shapes_changed(); } + +void CollisionObject2DSW::set_shape_metadata(int p_index,const Variant& p_metadata) { + + ERR_FAIL_INDEX(p_index,shapes.size()); + shapes[p_index].metadata=p_metadata; + +} + void CollisionObject2DSW::set_shape_transform(int p_index,const Matrix32& p_transform){ ERR_FAIL_INDEX(p_index,shapes.size()); diff --git a/servers/physics_2d/collision_object_2d_sw.h b/servers/physics_2d/collision_object_2d_sw.h index 1d61a1df4a..00ad361245 100644 --- a/servers/physics_2d/collision_object_2d_sw.h +++ b/servers/physics_2d/collision_object_2d_sw.h @@ -55,6 +55,7 @@ private: BroadPhase2DSW::ID bpid; Rect2 aabb_cache; //for rayqueries Shape2DSW *shape; + Variant metadata; bool trigger; Shape() { trigger=false; } }; @@ -97,11 +98,15 @@ public: void add_shape(Shape2DSW *p_shape,const Matrix32& p_transform=Matrix32()); void set_shape(int p_index,Shape2DSW *p_shape); void set_shape_transform(int p_index,const Matrix32& p_transform); + void set_shape_metadata(int p_index,const Variant& p_metadata); + + _FORCE_INLINE_ int get_shape_count() const { return shapes.size(); } _FORCE_INLINE_ Shape2DSW *get_shape(int p_index) const { return shapes[p_index].shape; } _FORCE_INLINE_ const Matrix32& get_shape_transform(int p_index) const { return shapes[p_index].xform; } _FORCE_INLINE_ const Matrix32& get_shape_inv_transform(int p_index) const { return shapes[p_index].xform_inv; } _FORCE_INLINE_ const Rect2& get_shape_aabb(int p_index) const { return shapes[p_index].aabb_cache; } + _FORCE_INLINE_ const Variant& get_shape_metadata(int p_index) const { return shapes[p_index].metadata; } _FORCE_INLINE_ Matrix32 get_transform() const { return transform; } _FORCE_INLINE_ Matrix32 get_inv_transform() const { return inv_transform; } diff --git a/servers/physics_2d/physics_2d_server_sw.cpp b/servers/physics_2d/physics_2d_server_sw.cpp index 09fa3f9b6a..ab85f5e1d6 100644 --- a/servers/physics_2d/physics_2d_server_sw.cpp +++ b/servers/physics_2d/physics_2d_server_sw.cpp @@ -548,6 +548,22 @@ void Physics2DServerSW::body_set_shape_transform(RID p_body, int p_shape_idx, co body->set_shape_transform(p_shape_idx,p_transform); } +void Physics2DServerSW::body_set_shape_metadata(RID p_body, int p_shape_idx, const Variant& p_metadata) { + + Body2DSW *body = body_owner.get(p_body); + ERR_FAIL_COND(!body); + body->set_shape_metadata(p_shape_idx,p_metadata); +} + + +Variant Physics2DServerSW::body_get_shape_metadata(RID p_body, int p_shape_idx) const { + + Body2DSW *body = body_owner.get(p_body); + ERR_FAIL_COND_V(!body,Variant()); + return body->get_shape_metadata(p_shape_idx); +} + + int Physics2DServerSW::body_get_shape_count(RID p_body) const { Body2DSW *body = body_owner.get(p_body); diff --git a/servers/physics_2d/physics_2d_server_sw.h b/servers/physics_2d/physics_2d_server_sw.h index 7ffffe669f..9edd4eee11 100644 --- a/servers/physics_2d/physics_2d_server_sw.h +++ b/servers/physics_2d/physics_2d_server_sw.h @@ -149,10 +149,14 @@ public: virtual void body_add_shape(RID p_body, RID p_shape, const Matrix32& p_transform=Matrix32()); virtual void body_set_shape(RID p_body, int p_shape_idx,RID p_shape); virtual void body_set_shape_transform(RID p_body, int p_shape_idx, const Matrix32& p_transform); + virtual void body_set_shape_metadata(RID p_body, int p_shape_idx, const Variant& p_metadata); + virtual int body_get_shape_count(RID p_body) const; virtual RID body_get_shape(RID p_body, int p_shape_idx) const; virtual Matrix32 body_get_shape_transform(RID p_body, int p_shape_idx) const; + virtual Variant body_get_shape_metadata(RID p_body, int p_shape_idx) const; + virtual void body_remove_shape(RID p_body, int p_shape_idx); virtual void body_clear_shapes(RID p_body); diff --git a/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp index 21a99cd4b2..8b72436936 100644 --- a/servers/physics_2d/space_2d_sw.cpp +++ b/servers/physics_2d/space_2d_sw.cpp @@ -126,6 +126,7 @@ bool Physics2DDirectSpaceStateSW::intersect_ray(const Vector2& p_from, const Vec if (r_result.collider_id!=0) r_result.collider=ObjectDB::get_instance(r_result.collider_id); r_result.normal=res_normal; + r_result.metadata=res_obj->get_shape_metadata(res_shape); r_result.position=res_point; r_result.rid=res_obj->get_self(); r_result.shape=res_shape; @@ -171,6 +172,7 @@ int Physics2DDirectSpaceStateSW::intersect_shape(const RID& p_shape, const Matri r_results[cc].collider=ObjectDB::get_instance(r_results[cc].collider_id); r_results[cc].rid=col_obj->get_self(); r_results[cc].shape=shape_idx; + r_results[cc].metadata=col_obj->get_shape_metadata(shape_idx); cc++; @@ -350,6 +352,7 @@ static void _rest_cbk_result(const Vector2& p_point_A,const Vector2& p_point_B,v rd->best_object=rd->object; rd->best_shape=rd->shape; + } @@ -399,6 +402,7 @@ bool Physics2DDirectSpaceStateSW::rest_info(RID p_shape, const Matrix32& p_shape r_info->normal=rcd.best_normal; r_info->point=rcd.best_contact; r_info->rid=rcd.best_object->get_self(); + r_info->metadata=rcd.best_object->get_shape_metadata(rcd.best_shape); if (rcd.best_object->get_type()==CollisionObject2DSW::TYPE_BODY) { const Body2DSW *body = static_cast<const Body2DSW*>(rcd.best_object); diff --git a/servers/physics_2d_server.cpp b/servers/physics_2d_server.cpp index da8ac5f9c8..cfa79e917d 100644 --- a/servers/physics_2d_server.cpp +++ b/servers/physics_2d_server.cpp @@ -97,6 +97,7 @@ void Physics2DDirectBodyState::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_contact_collider_id","contact_idx"),&Physics2DDirectBodyState::get_contact_collider_id); ObjectTypeDB::bind_method(_MD("get_contact_collider_object","contact_idx"),&Physics2DDirectBodyState::get_contact_collider_object); ObjectTypeDB::bind_method(_MD("get_contact_collider_shape","contact_idx"),&Physics2DDirectBodyState::get_contact_collider_shape); + ObjectTypeDB::bind_method(_MD("get_contact_collider_shape_metadata:var","contact_idx"),&Physics2DDirectBodyState::get_contact_collider_shape_metadata); ObjectTypeDB::bind_method(_MD("get_contact_collider_velocity_at_pos","contact_idx"),&Physics2DDirectBodyState::get_contact_collider_velocity_at_pos); ObjectTypeDB::bind_method(_MD("get_step"),&Physics2DDirectBodyState::get_step); ObjectTypeDB::bind_method(_MD("integrate_forces"),&Physics2DDirectBodyState::integrate_forces); @@ -244,6 +245,7 @@ Dictionary Physics2DDirectSpaceState::_intersect_ray(const Vector2& p_from, cons d["collider"]=inters.collider; d["shape"]=inters.shape; d["rid"]=inters.rid; + d["metadata"]=inters.metadata; return d; } @@ -262,6 +264,7 @@ Array Physics2DDirectSpaceState::_intersect_shape(const Ref<Physics2DShapeQueryP d["collider_id"]=sr[i].collider_id; d["collider"]=sr[i].collider; d["shape"]=sr[i].shape; + d["metadata"]=sr[i].metadata; ret[i]=d; } @@ -311,6 +314,7 @@ Dictionary Physics2DDirectSpaceState::_get_rest_info(const Ref<Physics2DShapeQue r["collider_id"]=sri.collider_id; r["shape"]=sri.shape; r["linear_velocity"]=sri.linear_velocity; + r["metadata"]=sri.metadata; return r; } @@ -446,10 +450,12 @@ void Physics2DServer::_bind_methods() { ObjectTypeDB::bind_method(_MD("body_add_shape","body","shape","transform"),&Physics2DServer::body_add_shape,DEFVAL(Matrix32())); ObjectTypeDB::bind_method(_MD("body_set_shape","body","shape_idx","shape"),&Physics2DServer::body_set_shape); ObjectTypeDB::bind_method(_MD("body_set_shape_transform","body","shape_idx","transform"),&Physics2DServer::body_set_shape_transform); + ObjectTypeDB::bind_method(_MD("body_set_shape_metadata","body","shape_idx","metadata"),&Physics2DServer::body_set_shape_metadata); ObjectTypeDB::bind_method(_MD("body_get_shape_count","body"),&Physics2DServer::body_get_shape_count); ObjectTypeDB::bind_method(_MD("body_get_shape","body","shape_idx"),&Physics2DServer::body_get_shape); ObjectTypeDB::bind_method(_MD("body_get_shape_transform","body","shape_idx"),&Physics2DServer::body_get_shape_transform); + ObjectTypeDB::bind_method(_MD("body_get_shape_metadata","body","shape_idx"),&Physics2DServer::body_get_shape_metadata); ObjectTypeDB::bind_method(_MD("body_remove_shape","body","shape_idx"),&Physics2DServer::body_remove_shape); ObjectTypeDB::bind_method(_MD("body_clear_shapes","body"),&Physics2DServer::body_clear_shapes); diff --git a/servers/physics_2d_server.h b/servers/physics_2d_server.h index 17a21e46a3..20d7c3ad28 100644 --- a/servers/physics_2d_server.h +++ b/servers/physics_2d_server.h @@ -71,6 +71,7 @@ public: virtual ObjectID get_contact_collider_id(int p_contact_idx) const=0; virtual Object* get_contact_collider_object(int p_contact_idx) const; virtual int get_contact_collider_shape(int p_contact_idx) const=0; + virtual Variant get_contact_collider_shape_metadata(int p_contact_idx) const=0; virtual Vector2 get_contact_collider_velocity_at_pos(int p_contact_idx) const=0; virtual real_t get_step() const=0; @@ -163,6 +164,7 @@ public: ObjectID collider_id; Object *collider; int shape; + Variant metadata; }; virtual bool intersect_ray(const Vector2& p_from, const Vector2& p_to,RayResult &r_result,const Set<RID>& p_exclude=Set<RID>(),uint32_t p_layer_mask=0xFFFFFFFF,uint32_t p_object_type_mask=TYPE_MASK_COLLISION)=0; @@ -173,6 +175,8 @@ public: ObjectID collider_id; Object *collider; int shape; + Variant metadata; + }; @@ -190,6 +194,7 @@ public: ObjectID collider_id; int shape; Vector2 linear_velocity; //velocity at contact point + Variant metadata; }; @@ -360,10 +365,12 @@ public: virtual void body_add_shape(RID p_body, RID p_shape, const Matrix32& p_transform=Matrix32())=0; virtual void body_set_shape(RID p_body, int p_shape_idx,RID p_shape)=0; virtual void body_set_shape_transform(RID p_body, int p_shape_idx, const Matrix32& p_transform)=0; + virtual void body_set_shape_metadata(RID p_body, int p_shape_idx, const Variant& p_metadata)=0; virtual int body_get_shape_count(RID p_body) const=0; virtual RID body_get_shape(RID p_body, int p_shape_idx) const=0; virtual Matrix32 body_get_shape_transform(RID p_body, int p_shape_idx) const=0; + virtual Variant body_get_shape_metadata(RID p_body, int p_shape_idx) const=0; virtual void body_set_shape_as_trigger(RID p_body, int p_shape_idx,bool p_enable)=0; virtual bool body_is_shape_set_as_trigger(RID p_body, int p_shape_idx) const=0; diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index e5f33b3d41..074fa5c946 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -1949,9 +1949,9 @@ void SpatialEditorViewport::_menu_option(int p_option) { bool current = view_menu->get_popup()->is_item_checked( idx ); current=!current; if (current) - camera->set_visible_layers( ((1<<20)-1)|(1<<(GIZMO_BASE_LAYER+index))|(1<<GIZMO_EDIT_LAYER) ); + camera->set_visible_layers( ((1<<20)-1)|(1<<(GIZMO_BASE_LAYER+index))|(1<<GIZMO_EDIT_LAYER)|(1<<GIZMO_GRID_LAYER) ); else - camera->set_visible_layers( ((1<<20)-1)|(1<<(GIZMO_BASE_LAYER+index)) ); + camera->set_visible_layers( ((1<<20)-1)|(1<<(GIZMO_BASE_LAYER+index))|(1<<GIZMO_GRID_LAYER) ); view_menu->get_popup()->set_item_checked( idx, current ); } break; @@ -1971,7 +1971,7 @@ void SpatialEditorViewport::_preview_exited_scene() { void SpatialEditorViewport::_init_gizmo_instance(int p_idx) { - uint32_t layer=1<<(GIZMO_BASE_LAYER+p_idx); + uint32_t layer=1<<(GIZMO_BASE_LAYER+p_idx)|(1<<GIZMO_GRID_LAYER); for(int i=0;i<3;i++) { move_gizmo_instance[i]=VS::get_singleton()->instance_create(); @@ -2163,7 +2163,7 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed surface->set_area_as_parent_rect(); camera = memnew(Camera); camera->set_disable_gizmo(true); - camera->set_visible_layers( ((1<<20)-1)|(1<<(GIZMO_BASE_LAYER+p_index))|(1<<GIZMO_EDIT_LAYER) ); + camera->set_visible_layers( ((1<<20)-1)|(1<<(GIZMO_BASE_LAYER+p_index))|(1<<GIZMO_EDIT_LAYER)|(1<<GIZMO_GRID_LAYER) ); //camera->set_environment(SpatialEditor::get_singleton()->get_viewport_environment()); viewport->add_child(camera); camera->make_current(); @@ -2906,6 +2906,7 @@ void SpatialEditor::_init_indicators() { light_instance=VisualServer::get_singleton()->instance_create2(light,get_scene()->get_root()->get_world()->get_scenario()); + light_transform.rotate(Vector3(1,0,0),Math_PI/5.0); VisualServer::get_singleton()->instance_set_transform(light_instance,light_transform); @@ -2964,10 +2965,12 @@ void SpatialEditor::_init_indicators() { VisualServer::get_singleton()->mesh_add_surface(grid[i],VisualServer::PRIMITIVE_LINES,d); VisualServer::get_singleton()->mesh_surface_set_material(grid[i],0,indicator_mat); grid_instance[i] = VisualServer::get_singleton()->instance_create2(grid[i],get_scene()->get_root()->get_world()->get_scenario()); + grid_visible[i]=false; grid_enable[i]=false; VisualServer::get_singleton()->instance_geometry_set_flag(grid_instance[i],VS::INSTANCE_FLAG_VISIBLE,false); VisualServer::get_singleton()->instance_geometry_set_flag(grid_instance[i],VS::INSTANCE_FLAG_CAST_SHADOW,false); + VS::get_singleton()->instance_set_layer_mask(grid_instance[i],1<<SpatialEditorViewport::GIZMO_GRID_LAYER); } @@ -2986,6 +2989,8 @@ void SpatialEditor::_init_indicators() { // VisualServer::get_singleton()->poly_add_primitive(origin,origin_points,Vector<Vector3>(),origin_colors,Vector<Vector3>()); // VisualServer::get_singleton()->poly_set_material(origin,indicator_mat,true); origin_instance = VisualServer::get_singleton()->instance_create2(origin,get_scene()->get_root()->get_world()->get_scenario()); + VS::get_singleton()->instance_set_layer_mask(origin_instance,1<<SpatialEditorViewport::GIZMO_GRID_LAYER); + VisualServer::get_singleton()->instance_geometry_set_flag(origin_instance,VS::INSTANCE_FLAG_CAST_SHADOW,false); @@ -3021,6 +3026,8 @@ void SpatialEditor::_init_indicators() { VisualServer::get_singleton()->mesh_surface_set_material(cursor_mesh,0,cmat,true); cursor_instance = VisualServer::get_singleton()->instance_create2(cursor_mesh,get_scene()->get_root()->get_world()->get_scenario()); + VS::get_singleton()->instance_set_layer_mask(cursor_instance,1<<SpatialEditorViewport::GIZMO_GRID_LAYER); + VisualServer::get_singleton()->instance_geometry_set_flag(cursor_instance,VS::INSTANCE_FLAG_CAST_SHADOW,false); diff --git a/tools/editor/plugins/spatial_editor_plugin.h b/tools/editor/plugins/spatial_editor_plugin.h index 797ef08099..1fdc97c49d 100644 --- a/tools/editor/plugins/spatial_editor_plugin.h +++ b/tools/editor/plugins/spatial_editor_plugin.h @@ -87,7 +87,8 @@ friend class SpatialEditor; public: enum { GIZMO_BASE_LAYER=27, - GIZMO_EDIT_LAYER=26 + GIZMO_EDIT_LAYER=26, + GIZMO_GRID_LAYER=25 }; private: int index; |