private double GetCrossTickRight(Component c) { if (c is Physical ph) { return(Math.Min(ph.Position.X, ph.PreviousPosition.X)); } ph = c.Owner.Components.Get <Physical>(); SoftBody sb = c as SoftBody; CollisionBox box = (c is RigidBody rb) ? rb.UnionBounds : sb?.Bounds; return(Math.Max( box.Offset(ph.Position).Right, box.Offset(ph.PreviousPosition).Right )); }
private double GetCrossTickLeft(Component c) { if (c is Physical ph) { return(Math.Min(ph.Position.X, ph.PreviousPosition.X)); } ph = c.Owner.Components.Get <Physical>(); SoftBody sb = c as SoftBody; Transform sp = c.Owner.GetComponent <Transform>(); CollisionBox box = (c is RigidBody rb) ? rb.UnionBounds : sb?.Bounds; return(Math.Min( box.Offset(ph?.Position ?? sp?.Position ?? Vector2D.Empty).Left, box.Offset(ph?.PreviousPosition ?? sp?.Position ?? Vector2D.Empty).Left )); }