internal void SetPosition(Vector2F position)
{
// Set new position.
this.Position = position;
// Rotate anchors if necessary.
if (this.Rotation <= 0)
{
return;
}
var center = this.Extents / 2;
foreach (Anchor2D anchor in this.ChunkAnchors)
{
var origin = anchor.RelativePosition - center;
var anchorRelativePositionX = (origin.X * (float)Math.Cos(this.Rotation))
- (origin.Y * (float)Math.Sin(this.Rotation)) + center.Y;
var anchorRelativePositionY = (origin.Y * (float)Math.Cos(this.Rotation))
+ (origin.X * (float)Math.Sin(this.Rotation)) + center.X;
anchor.RelativePosition = new Vector2F(anchorRelativePositionX, anchorRelativePositionY);
}
}