Ah this makes sense, I see. I'm very glad my information was useful (should have mentioned that it was only happening on the flat bits of the terrain, I didn't make that connection in my head), I've turned off ImproveBoundaryBehavior on the terrain and it completely fixed that issue, thanks for the guidance
Will grab the full fix from the development branch when the time is right for it, this interim fix means it is not urgent.
My only other question would be - I noticed that if I spawn the entities 10m above the ground, they fall and hit it, but if I go with 5m, then they fall through it. I'm not sure why this would occur, they all have the same radius of 0.9m, and I use a raycast to ensure that they are all the appropriate distance above the ground:
Code: Select all
//-------------------------------------------------------------------------------
private float ComputeAltitude()
{
var fromPosition = _position + new Vector3( 0f, ALTITUDE_RAY_OFFSET, 0f );
var altitudeRay = new Ray( fromPosition, Vector3.Down );
RayCastResult result;
ThePhysicsSpace.RayCast( altitudeRay, ALTITUDE_RAY_LENGTH, out result );
return result.HitData.Location.Y;
}
Here is how the terrain is set up, perhaps it is missing something? Or maybe the Physics system should receive at least one update before anything gets spawned?
Code: Select all
{
var terrainShape = new TerrainShape( GroundMiner.GetAltitudeArray(), QuadTriangleOrganization.BottomRightUpperLeft );
var terrainTransform = new AffineTransform( Vector3.Zero );
var terrain = new Terrain( terrainShape, terrainTransform );
terrain.CollisionRules.Group = BepuCollisionRules.StaticLevelGroup;
// We turn this off, as an interim measure to fix characters directly over vertices on flat terrain falling through
terrain.ImproveBoundaryBehavior = false;
terrain.Thickness = 1f;
terrain.UpdateBoundingBox();
ThePhysicsSpace.Add( terrain );
}
All suggestions/ideas welcomed - I feel its important to follow all best practices when using a system
Eclectus