-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Interpolate parts in local space to avoid broken cursor trails #29253
Conversation
@@ -174,10 +183,10 @@ protected void AddTrail(Vector2 position) | |||
float distance = diff.Length; | |||
Vector2 direction = diff / distance; | |||
|
|||
float interval = partSize.X / 2.5f * IntervalMultiplier; | |||
float stopAt = distance - (AvoidDrawingNearCursor ? interval : 0); | |||
Vector2 interval = partSize.X / 2.5f * IntervalMultiplier * scaleRatio; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It sounds like you should be able to remove the scale from partSize
, and, along with that, use Texture.DisplayWidth
directly (and remove the two LayoutValue
s? This is the only usage of it after all.
Have you also made sure that the trail visually looks the same as in current master?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you also made sure that the trail visually looks the same as in current master?
yes, that's why I use extract scaleRatio from DrawInfo.MatrixInverse
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use
Texture.DisplayWidth
directly (and remove the twoLayoutValue
s? This is the only usage of it after all.
do I have to use a vector? I don't know if the DisplayWidth is guaranteed equal to DisplayHeight.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's three choices:
new Vector2(Texture.DisplayWidth, Texture.DisplayHeight)
new Vector2(Texture.DisplayWidth)
- Or go back to using
float
and justTexture.DisplayWidth
Personally, I would choose (3) just so that we don't inadvertently break something else with this PR, but I'm not sure why you've gone to using a vector other than that it looks more correct, which I would be willing to entertain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, if there's a strong reason not to, then I would suggest doing (3) for a "fix" PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but I'm not sure why you've gone to using a vector other than that it looks more correct, which I would be willing to entertain.
not for special reasons, just because the extracted scale is a vector and in case some parents scale the X-axis and Y-axis differently. I'll go with (3) then
Very smooth, thanks for the fix. ❤️ |
fixes #29214
The trail parts were originally interpolated in the screen space but stored in local space. With
Barrel Roll
on, even if we are adding trails at the same position, the new parts have different angles compared to the previous parts because the whole playfield is rotating. This leads to the incorrect interpolation direction(position - lastPosition
) because thelastPosition
was actually rotated back a little relatively.This PR interpolates parts in the local space, so the interpolation always follows the correct direction.
2024-08-02.17-09-12.mp4