Ground level now at height 0.
parent
1e7e07f349
commit
e91b64e82f
|
@ -269,7 +269,6 @@ public class Game : Spatial
|
|||
public void OnTileHovered(HexTile3D tile)
|
||||
{
|
||||
Transform highlightTransform = tile.GlobalTransform;
|
||||
highlightTransform.origin.y += 0.1f;
|
||||
_mouseTileHighlight.Transform = highlightTransform;
|
||||
_mouseWorldLabel.Text = highlightTransform.origin.ToString();
|
||||
_mouseTileOffsetLabel.Text = tile.OffsetCoords.ToString();
|
||||
|
|
|
@ -40,7 +40,7 @@ public class TileWorld : Spatial
|
|||
[Export] public int Size = 64;
|
||||
[Export] public bool DebugMap;
|
||||
|
||||
public float HeightScale = 2.0f;
|
||||
public float HeightScale = 1.0f;
|
||||
public Image HeightmapImage;
|
||||
public Image ColormapImage;
|
||||
public Image NavigationmapImage;
|
||||
|
@ -293,7 +293,7 @@ public class TileWorld : Spatial
|
|||
Spatial assetInstance = (Spatial)assets[assetIndex].Duplicate();
|
||||
Transform assetTransform = Transform.Identity;
|
||||
assetTransform.origin = GetHexCenterFromOffset(offsetCoord);
|
||||
assetTransform.origin.y += 1.2f;
|
||||
assetTransform.origin.y = GetHeightAtOffset(offsetCoord);
|
||||
assetTransform.basis =
|
||||
assetTransform.basis.Rotated(Vector3.Up, (float)(randomGenerator.NextDouble() * Mathf.Pi * 2));
|
||||
assetInstance.Transform = assetTransform;
|
||||
|
@ -364,7 +364,7 @@ public class TileWorld : Spatial
|
|||
Chest chestAsset = (Chest)_chestScene.Instance();
|
||||
Transform assetTransform = Transform.Identity;
|
||||
assetTransform.origin = GetHexCenterFromOffset(offsetCoord);
|
||||
assetTransform.origin.y += 1.2f;
|
||||
assetTransform.origin.y = GetHeightAtOffset(offsetCoord);
|
||||
chestAsset.Transform = assetTransform;
|
||||
Entities.AddChild(chestAsset);
|
||||
MarkCellUnwalkable(cell);
|
||||
|
@ -461,14 +461,18 @@ public class TileWorld : Spatial
|
|||
|
||||
Vector2 textureCoord = OffsetToTextureCoord(offsetCoord);
|
||||
|
||||
float heightmapHeight = HeightmapImage.GetPixel((int)textureCoord.x, (int)(textureCoord.y)).r;
|
||||
float heightmapHeight = (HeightmapImage.GetPixel((int)textureCoord.x, (int)(textureCoord.y)).r - 0.5f) * HeightScale;
|
||||
|
||||
if (heightmapHeight > 0.5)
|
||||
if (heightmapHeight <= 0)
|
||||
{
|
||||
heightmapHeight = 0.6f;
|
||||
heightmapHeight -= 0.03f;
|
||||
}
|
||||
else
|
||||
{
|
||||
heightmapHeight = 0f;
|
||||
}
|
||||
|
||||
return heightmapHeight * HeightScale;
|
||||
return heightmapHeight;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ roughness = 0.0
|
|||
[node name="TileHighlight" type="Spatial"]
|
||||
|
||||
[node name="TileMesh" type="MeshInstance" parent="."]
|
||||
transform = Transform( -4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 0, -0.05, 0 )
|
||||
transform = Transform( -4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 0, 0, 0 )
|
||||
cast_shadow = 0
|
||||
mesh = SubResource( 3 )
|
||||
skeleton = NodePath("../..")
|
||||
|
|
Loading…
Reference in New Issue