How do I get rid of this snapping?

The hypotenuse line in my pythagorean visualization is snapping to some sort of invisible grid, as seen in the list being said by the stage, the hypotenuse itself is clearly smooth though.

This is not wanted behavior, I would like it if the hypotenuse line was as smooth as the x and y line.

Here's the project so you guys can alter the code in ways, trying to make it work.

I'm afraid this is inherent to the fact that the hypotenuse is not rectangular to the grid.

I must have misread your post. Dardoro is right.

Direction has a resolution of 1 degree. Lines drawn 1 degree apart

Use Pythagoras script pic for the third vertex.

Do you mean in Snap!, or in their project? Pretty sure the former can't be true.

I think this shows that it doesn't have a resolution on 1 degree

Screenshot from 2024-04-19 07-18-05
Screenshot from 2024-04-19 07-18-39

The issue is with Pythagoras script pic, which - don’t ask me why - always reports an integer.

It’s true, though. It may be intended, but I’d qualify it as a bug.

UPDATE: it's not exactly what I thought at first. See posts #8 a.o.

Direction isn't just integer for me

O, I see the real problem now, it’s with point towards:

untitled script pic 259

Still a bug, IMAO (@bh).

Yes, the direction of the sprite pointing towards mouse-pointer is an integer
untitled script pic (61)

So the sin(direction)*(distance from the center) snapps few pixels.

aaah - got you now :slight_smile:

Good catch guys

I have this block in my tool box (angle between):
Point torwards mouse
Replace the point towards block with this code like this:

About your project:
i like this idea:
Pythagoras script pic (1)
instead of:
Pythagoras script pic (2)
(no lag)

I think you should store the mouse position in a variable at the beginning of the script and use this var for the rest of the script.

Why ? Nothing guaranteed the mouse position (or mousex,y) is the same along the script because this function was evaluated on the fly when the code was executed
(in this specific case, no problem because you don't use for loop or repeat structure)

Another way to solve this: use a warp block INSIDE the forever loop

I was confused at first but I remembered I'd actually done that trick in a few previous projects.

I really don't think it should be an issue but I put it in because there wasn't really a good reason not to.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.