Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix instant spinners giving insane amounts of strain #15009

Merged
merged 4 commits into from
Oct 15, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,23 +69,26 @@ private void setDistances()
TravelDistance = lastSlider.LazyTravelDistance * scalingFactor;
}

Vector2 lastCursorPosition = getEndCursorPosition(lastObject);
if (!(lastObject is Spinner))
stanriders marked this conversation as resolved.
Show resolved Hide resolved
{
Vector2 lastCursorPosition = getEndCursorPosition(lastObject);

// Don't need to jump to reach spinners
if (!(BaseObject is Spinner))
JumpDistance = (BaseObject.StackedPosition * scalingFactor - lastCursorPosition * scalingFactor).Length;
// Don't need to jump to reach spinners
if (!(BaseObject is Spinner))
JumpDistance = (BaseObject.StackedPosition * scalingFactor - lastCursorPosition * scalingFactor).Length;

if (lastLastObject != null)
{
Vector2 lastLastCursorPosition = getEndCursorPosition(lastLastObject);
if (lastLastObject != null)
{
Vector2 lastLastCursorPosition = getEndCursorPosition(lastLastObject);

Vector2 v1 = lastLastCursorPosition - lastObject.StackedPosition;
Vector2 v2 = BaseObject.StackedPosition - lastCursorPosition;
Vector2 v1 = lastLastCursorPosition - lastObject.StackedPosition;
Vector2 v2 = BaseObject.StackedPosition - lastCursorPosition;

float dot = Vector2.Dot(v1, v2);
float det = v1.X * v2.Y - v1.Y * v2.X;
float dot = Vector2.Dot(v1, v2);
float det = v1.X * v2.Y - v1.Y * v2.X;

Angle = Math.Abs(Math.Atan2(det, dot));
Angle = Math.Abs(Math.Atan2(det, dot));
}
}
}

Expand Down