Tweak reach rules a bit
This commit is contained in:
parent
d238e12f56
commit
10a84b94ee
@ -56,7 +56,7 @@ namespace TrueCraft.Client.Modules
|
||||
|
||||
var cast = VoxelCast.Cast(Game.Client.World,
|
||||
new TRay(Game.Camera.Position, new TVector3(direction.X, direction.Y, direction.Z)),
|
||||
Game.BlockRepository, (int)TrueCraftGame.Reach);
|
||||
Game.BlockRepository, TrueCraftGame.Reach, TrueCraftGame.Reach + 2);
|
||||
|
||||
if (cast == null)
|
||||
HighlightedBlock = -Coordinates3D.One;
|
||||
|
@ -46,7 +46,7 @@ namespace TrueCraft.Client
|
||||
private GameTime GameTime { get; set; }
|
||||
private DebugInfoModule DebugInfoModule { get; set; }
|
||||
|
||||
public static readonly double Reach = 3;
|
||||
public static readonly int Reach = 3;
|
||||
|
||||
public IBlockRepository BlockRepository
|
||||
{
|
||||
|
@ -15,17 +15,17 @@ namespace TrueCraft.Client
|
||||
// Thanks to http://gamedev.stackexchange.com/questions/47362/cast-ray-to-select-block-in-voxel-game
|
||||
|
||||
public static Tuple<Coordinates3D, BlockFace> Cast(ReadOnlyWorld world,
|
||||
Ray ray, IBlockRepository repository, int max)
|
||||
Ray ray, IBlockRepository repository, int posmax, int negmax)
|
||||
{
|
||||
// TODO: There are more efficient ways of doing this, fwiw
|
||||
|
||||
double min = max * 2;
|
||||
double min = negmax * 2;
|
||||
var pick = -Coordinates3D.One;
|
||||
for (int x = -max; x <= max; x++)
|
||||
for (int x = -posmax; x <= posmax; x++)
|
||||
{
|
||||
for (int y = -max; y <= max; y++)
|
||||
for (int y = -negmax; y <= posmax; y++)
|
||||
{
|
||||
for (int z = -max; z <= max; z++)
|
||||
for (int z = -posmax; z <= posmax; z++)
|
||||
{
|
||||
var coords = (Coordinates3D)(new Vector3(x, y, z) + ray.Position).Round();
|
||||
if (!world.IsValidPosition(coords))
|
||||
|
Loading…
x
Reference in New Issue
Block a user