# Snap to zAxis

Ketil Bergesen shared this question 1 year ago

Hello!I have a point A on the zAxis that I would like to allow only integer z-values. Is there a way to do this? I have tried with the following script (OnUpdate):

SetValue(z(A),round(z(A)) with no luck...

Thank you!

Ketil Bergesen

1

Your question suggests that the grneral setting for the 3D View is not what you want. If you want the option just of that point on the zAxis you could create a list l1=Sequence{(0,0,n), n, -20, 20) an define P = Point(l1) and hide the list. Of course the -20 and +20 are just an exemple, you can make the reach larger if it's conveniant.

chris

1

Hi again. Thank you for your answer, which partly solves the problem. The thing is I would like the point to be draggable, jumping from one integer value to the next like you can do in 2D. I see the problem in 3D as the screen is 2D, but if a point is bound to the z-axis there would be no ambiguity :)

Best regards

Ketil Bergesen

1

Try this:

`Point(Sequence((0,0,i),i,-10,10))`

1

Thank you again, but this will generate 21 points on the z-axis, I would like the point on the z-axis to be draggable, jumping from (0,0, n) to (0,0, n pluss/minus 1) at the time.

As far as I know it does not exist a y-mouse variable in ggb, but this could solve the problem.

Best regards!

Ketil Bergesen

1

I am so sorry, what you suggested works perfectly, I misinterpreted what it actually does!

Ketil Bergesen

1

do you mean D or B or F?

I love dynamicoords

Files: foro.ggb
1

I mean D, but that point seems to be frozen to (0,0,2) in the attached file.

I would like the point on the z-axis to be draggable, jumping from (0,0, n) to (0,0, n pluss/minus 1) at the time.

Bet regards

Ketil Bergesen

1

No frozen

click on a point for changing the moving direction (some gray arrows are shown for this), when the gray arrows are vertical then D can be moved up and down