Skip to content

TrackballControls triggering "change" event unnecessarily #2694

@davidberneda

Description

@davidberneda

(Don't know if its a bug or a feature)

Due to floating point precision, in some cases the following condition is always true:

if ( lastPosition.distanceToSquared( _this.object.position ) > 0 ) {
    _this.dispatchEvent( changeEvent );
   ....

Even when lastPosition and object.position are equal, the resulting distance never gets to absolute zero, is very very small ( ie: 2E-14 ) and the change event never stops.

A fix proposal:

var EPSILON = 0.001;

if ( lastPosition.distanceToSquared( _this.object.position ) > EPSILON ) {

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions