Fix falling sand entities
This commit is contained in:
parent
1aa81a7d58
commit
52241a5ea3
@ -146,7 +146,7 @@ namespace TrueCraft.API
|
|||||||
|
|
||||||
public void Intersects(ref BoundingBox box, out bool result)
|
public void Intersects(ref BoundingBox box, out bool result)
|
||||||
{
|
{
|
||||||
if ((this.Max.X >= box.Min.X) && (this.Min.X <= box.Max.X))
|
if ((this.Max.X > box.Min.X) && (this.Min.X < box.Max.X))
|
||||||
{
|
{
|
||||||
if ((this.Max.Y < box.Min.Y) || (this.Min.Y > box.Max.Y))
|
if ((this.Max.Y < box.Min.Y) || (this.Min.Y > box.Max.Y))
|
||||||
{
|
{
|
||||||
@ -154,7 +154,7 @@ namespace TrueCraft.API
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = (this.Max.Z >= box.Min.Z) && (this.Min.Z <= box.Max.Z);
|
result = (this.Max.Z > box.Min.Z) && (this.Min.Z < box.Max.Z);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ namespace TrueCraft.Core.Entities
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return new BoundingBox(Vector3.Zero, Vector3.One);
|
return new BoundingBox(Position, Position + Size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ namespace TrueCraft.Core.Entities
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return 0.4f;
|
return 0.04f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ namespace TrueCraft.Core.Entities
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return 0.2f;
|
return 0.02f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,8 +54,9 @@ namespace TrueCraft
|
|||||||
if (multipler < 0.1) multipler = 0.1;
|
if (multipler < 0.1) multipler = 0.1;
|
||||||
lock (EntityLock)
|
lock (EntityLock)
|
||||||
{
|
{
|
||||||
foreach (var entity in Entities)
|
for (int i = 0; i < Entities.Count; i++)
|
||||||
{
|
{
|
||||||
|
var entity = Entities[i];
|
||||||
if (entity.BeginUpdate())
|
if (entity.BeginUpdate())
|
||||||
{
|
{
|
||||||
entity.Velocity -= new Vector3(0, entity.AccelerationDueToGravity * multipler, 0);
|
entity.Velocity -= new Vector3(0, entity.AccelerationDueToGravity * multipler, 0);
|
||||||
@ -145,7 +146,7 @@ namespace TrueCraft
|
|||||||
var boundingBox = BlockPhysicsProvider.GetBoundingBox(world, position);
|
var boundingBox = BlockPhysicsProvider.GetBoundingBox(world, position);
|
||||||
if (boundingBox == null)
|
if (boundingBox == null)
|
||||||
continue;
|
continue;
|
||||||
blockBox = boundingBox.Value.OffsetBy(position);
|
blockBox = boundingBox.Value.OffsetBy(position + new Vector3(0.5));
|
||||||
if (TempBoundingBox.Intersects(blockBox))
|
if (TempBoundingBox.Intersects(blockBox))
|
||||||
{
|
{
|
||||||
if (entity.Velocity.X < 0)
|
if (entity.Velocity.X < 0)
|
||||||
@ -253,7 +254,7 @@ namespace TrueCraft
|
|||||||
var boundingBox = BlockPhysicsProvider.GetBoundingBox(world, position);
|
var boundingBox = BlockPhysicsProvider.GetBoundingBox(world, position);
|
||||||
if (boundingBox == null)
|
if (boundingBox == null)
|
||||||
continue;
|
continue;
|
||||||
blockBox = boundingBox.Value.OffsetBy(position);
|
blockBox = boundingBox.Value.OffsetBy(position + new Vector3(0.5));
|
||||||
if (TempBoundingBox.Intersects(blockBox))
|
if (TempBoundingBox.Intersects(blockBox))
|
||||||
{
|
{
|
||||||
if (entity.Velocity.Y < 0)
|
if (entity.Velocity.Y < 0)
|
||||||
@ -351,7 +352,7 @@ namespace TrueCraft
|
|||||||
var boundingBox = BlockPhysicsProvider.GetBoundingBox(world, position);
|
var boundingBox = BlockPhysicsProvider.GetBoundingBox(world, position);
|
||||||
if (boundingBox == null)
|
if (boundingBox == null)
|
||||||
continue;
|
continue;
|
||||||
blockBox = boundingBox.Value.OffsetBy(position);
|
blockBox = boundingBox.Value.OffsetBy(position + new Vector3(0.5));
|
||||||
if (TempBoundingBox.Intersects(blockBox))
|
if (TempBoundingBox.Intersects(blockBox))
|
||||||
{
|
{
|
||||||
if (entity.Velocity.Z < 0)
|
if (entity.Velocity.Z < 0)
|
||||||
|
Reference in New Issue
Block a user