private void DoMove() { VRageMath.BoundingBoxD aggregatebox = new VRageMath.BoundingBoxD(); for (var x = 0; x < Entities.Count; x++) { var entity = MyAPIGateway.Entities.GetEntityById(Entities[x]); if (entity != null) { var box = entity.PositionComp.WorldAABB; box.Translate(entity.PositionComp.GetPosition() - Positions[x]); aggregatebox.Include(ref box); } } MyAPIGateway.Physics.EnsurePhysicsSpace(aggregatebox); for (var x = 0; x < Entities.Count; x++) { var entity = MyAPIGateway.Entities.GetEntityById(Entities[x]); if (entity != null) { entity.PositionComp.SetPosition(Positions[x]); //if (entity.SyncObject != null) // entity.SyncObject.UpdatePosition(); Logger.Instance.LogMessage(string.Format("updated {0} to: {1:F0}, {2:F0}, {3:F0}", entity.DisplayName, Positions[x].X, Positions[x].Y, Positions[x].Z)); } } }
void UpdateBoundingFrustum() { // Update frustum BoundingFrustum.Matrix = ViewProjectionMatrix; BoundingFrustumFar.Matrix = ViewProjectionMatrixFar; // Update bounding box BoundingBox = BoundingBoxD.CreateInvalid(); BoundingBox.Include(ref BoundingFrustum); // Update bounding sphere BoundingSphere = MyUtils.GetBoundingSphereFromBoundingBox(ref BoundingBox); }