javascriptthree.jsuser-controlstrackball

TrackballControls - what does the "staticMoving" property do?


In the library module called THREE.TrackballControls there is a property on an instance of the module called staticMoving which seems to be related to a property called dynamicDampingFactor. Unfortunately, I am unable to find any documentation upon it and looking at it in the source code isn't helping me.

Does anyone know what the semantics of these properties might be?


Solution

  • If you set staticMoving on your THREE.TrackballControls to true it means that damping is not enabled. When you set it to false damping is enabled and you can set the amount of the damping effect with the dynamicDamingFactor. Maybe you didn't notice the effect but if you set the value really small (for example 0.02) you will immediately understand what this effect means:

    controls.staticMoving = false;
    controls.dynamicDampingFactor = 0.02;
    

    Check a demonstration of this damping effect here in this fiddle.

    If you set controls.staticMoving = true; in this fiddle you will see that the damping effect is turned off.


    This effect can also be found in other controls like for example the THREE.OrbitControls but here the properties are called enableDamping and dampingFactor which in my opinion are a bit more intuitive but the effect is the same.
    It is a pity that the API for those controls are not corresponding, but I guess that is because they fall a bit outside the scope of the three.js framework and they are considered "code examples".