Issue with changing the value of a Vector with GeoGebra Script

Samuel Egger shared this question 2 years ago
Answered

Hello

I am trying to set the value of a vector based on some condition with

If(dot > 0.8, SetValue[u,(0,0,1)], SetValue[u,(0,1,0)])

in the On Update tab (A). However, if the value of dot changes, nothing happens.

You find my sample project here: https://www.geogebra.org/3d...

Looking forward for your help, Samuel

Comments (2)

photo
2

SetValue(u, If(dot>0.8, (0, 0 ,1),(0, 1, 0))) works as On Update script.

chris

photo
2

Your definition of u should be as follows:

u=(0,1,0)

Note: the lower-case name (at first definition) determines that it is a vector

Both your syntax and the syntax of chris lead to the desired result.

----------------------------------------------------------------------

u=Vector((0,1,0))

is a dependent object. These cannot be changed with SetValue().

© 2023 International GeoGebra Institute