Properly place entities at their corresponding heights.
parent
866fd11399
commit
555982262f
|
@ -252,6 +252,16 @@ public class Game : Spatial
|
|||
_player.Transform = playerStartTransform;
|
||||
_player.TaskQueueComponent.Reset();
|
||||
_player.Navigation.PlanDirectPath(playerStartTransform.origin, playerStartTransform.origin, playerStartTransform.basis.Quat());
|
||||
|
||||
foreach (Spatial entity in GetNode("Entities").GetChildren())
|
||||
{
|
||||
Transform entityTransform = entity.Transform;
|
||||
Vector2 entityPlanePos = new Vector2(entityTransform.origin.x, entityTransform.origin.z);
|
||||
Vector2 entityOffsetCoordinates = _hexGrid.GetHexAt(entityPlanePos).OffsetCoords;
|
||||
float entityHeight = _tileWorld.GetHeightAtOffset(entityOffsetCoordinates);
|
||||
entityTransform.origin.y = entityHeight;
|
||||
entity.Transform = entityTransform;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnWorldGenerated()
|
||||
|
|
Loading…
Reference in New Issue