mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-11 19:05:54 +00:00
New navigation
This commit is contained in:
parent
c8cbad3268
commit
86f7459837
8 changed files with 119 additions and 56 deletions
|
|
@ -14,7 +14,7 @@ public partial class TilemapAvoidance : TileMapLayer
|
|||
public override void _Ready()
|
||||
{
|
||||
//NavigationServer2D.MapSetEdgeConnectionMargin(this.TileSet.GetRid(), 0f);
|
||||
_ = RefreshNavigationAsync();
|
||||
//_ = RefreshNavigationAsync();
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -41,16 +41,16 @@ public partial class TilemapAvoidance : TileMapLayer
|
|||
//
|
||||
if (_needsFullCheck)
|
||||
{
|
||||
var spaceState = GetWorld2D().DirectSpaceState;
|
||||
var globalCoords = ToGlobal(this.MapToLocal(coords));
|
||||
var query = new PhysicsPointQueryParameters2D();
|
||||
query.Position = globalCoords;
|
||||
query.CollisionMask = ObstaclesCollisionMask;
|
||||
query.CollideWithBodies = true;
|
||||
query.CollideWithAreas = true;
|
||||
|
||||
var result = spaceState.IntersectPoint(query);
|
||||
if (result.Count > 0) return true;
|
||||
// var spaceState = GetWorld2D().DirectSpaceState;
|
||||
// var globalCoords = ToGlobal(this.MapToLocal(coords));
|
||||
// var query = new PhysicsPointQueryParameters2D();
|
||||
// query.Position = globalCoords;
|
||||
// query.CollisionMask = ObstaclesCollisionMask;
|
||||
// query.CollideWithBodies = true;
|
||||
// query.CollideWithAreas = true;
|
||||
//
|
||||
// var result = spaceState.IntersectPoint(query);
|
||||
// if (result.Count > 0) return true;
|
||||
|
||||
//_needsFullCheck = false;
|
||||
return _solidLayers.Aggregate(false,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue