public Vector2d Rotated(long cos, long sin) { Vector2d vec = this; vec.Rotate(cos, sin); return(vec); }
public void UpdateLocalRotation() { if (HasParent) { LocalRotation = Rotation; LocalRotation.Rotate(_parent.Rotation.x, _parent.Rotation.y); } }
public void UpdateLocalPosition() { if (HasParent) { LocalPosition = Position - _parent.Position; LocalPosition.Rotate(_parent.Rotation.x, _parent.Rotation.y); } }
public void Rotate(long cos, long sin) { if (HasParent) { LocalRotation.Rotate(cos, sin); } else { Rotation.Rotate(cos, sin); } RotationChanged = true; }
public void Simulate () { if (HasParent) { if (_parent.RotationChangedBuffer) { Position = LocalPosition; Position.Rotate (_parent.Rotation.x,_parent.Rotation.y); Position += _parent.Position; Rotation = LocalRotation; Rotation.Rotate (_parent.Rotation.x,_parent.Rotation.y); RotationChanged = true; PositionChanged = true; } else if (_parent.PositionChangedBuffer) { Position += _parent.Offset; PositionChanged = true; } } if (PositionChanged || RotationChanged) { if (PositionChanged) { FuturePosition.x = Position.x + Velocity.x * PhysicsManager.ColSpreadMul; FuturePosition.y = Position.y + Velocity.y * PhysicsManager.ColSpreadMul; SetPositionBuffer = true; } else { } if (RotationChanged) { SetRotationBuffer = true; } else { } BuildPoints (); BuildBounds (); PositionChanged = false; RotationChanged = false; } else { } }
public void Rotate(long cos, long sin) { _rotation.Rotate(cos, sin); RotationChanged = true; }
public void Simulate() { if (HasParent) { if (_parent.RotationChangedBuffer) { Position = LocalPosition; Position.Rotate (_parent.Rotation.x,_parent.Rotation.y); Position += _parent.Position; Rotation = LocalRotation; Rotation.Rotate (_parent.Rotation.x,_parent.Rotation.y); RotationChanged = true; PositionChanged = true; } else if (_parent.PositionChangedBuffer) { Position += _parent.Offset; PositionChanged = true; } } if (PositionChanged || RotationChanged) { if (PositionChanged) { FuturePosition.x = Position.x + Velocity.x * PhysicsManager.ColSpreadMul; FuturePosition.y = Position.y + Velocity.y * PhysicsManager.ColSpreadMul; SetPositionBuffer = true; } else { } if (RotationChanged) { SetRotationBuffer = true; } else { } BuildPoints (); BuildBounds (); PositionChanged = false; RotationChanged = false; } else { } }
public Vector2d InverseTransformDirection(Vector2d localPos) { localPos.Rotate(_rotation.x, _rotation.y); localPos += _position; return(localPos); }