public void Simulate() { if (VelocityChanged) { VelocityMagnitude = _velocity.Magnitude(); VelocityChanged = false; } LastPosition = _position; if (VelocityMagnitude != 0) { _position.x += _velocity.x / LockstepManager.FrameRate; _position.y += _velocity.y / LockstepManager.FrameRate; PositionChanged = true; } BuildChangedValues(); PartitionChanged = false; if (PositionChanged || this.PositionChangedBuffer) { Partition.UpdateObject(this); } if (SettingVisuals) { _settingVisualsCounter--; } }
public void EarlySimulate () { if (HasParent) { } else { if (VelocityChanged) { VelocityMagnitude = Velocity.Magnitude (); VelocityChanged = false; } if (VelocityMagnitude != 0) { Position.x += Velocity.x; Position.y += Velocity.y; PositionChanged = true; } } if (PositionChanged) { Partition.PartitionObject (this); Offset = Position - LastPosition; LastPosition = Position; PositionChangedBuffer = true; } else { PositionChangedBuffer = false; } if (RotationChanged) { RotationChangedBuffer = true; } else { RotationChangedBuffer = false; } }
public long GetClosestDist(Vector2d target) { switch (this.Shape) { case ColliderType.Circle: { Vector2d delta = this._position - target; long mag = delta.Magnitude(); return(mag - this._radius); } break; } return((this._position - target).Magnitude()); }
public Vector2d GetClosestPoint(Vector2d target) { switch (this.Shape) { case ColliderType.Circle: { Vector2d delta = this._position - target; long mag = delta.Magnitude(); delta *= mag - this._radius; return(target + delta); } break; } return(this._position - target); }
public void EarlySimulate() { if (VelocityChanged) { VelocityMagnitude = Velocity.Magnitude(); VelocityChanged = false; } if (VelocityMagnitude != 0) { Position.x += Velocity.x; Position.y += Velocity.y; PositionChanged = true; } }
public void _SimVelocity() { if (VelocityChanged) { VelocityMagnitude = _velocity.Magnitude(); VelocityChanged = false; } LastPosition = _position; if (VelocityMagnitude != 0) { _position.x += _velocity.x / LockstepManager.FrameRate; _position.y += _velocity.y / LockstepManager.FrameRate; PositionChanged = true; } }