# OrbitControls on damping end

**URL:** <https://discourse.threejs.org/t/orbitcontrols-on-damping-end/21173>\
**Category:** Questions\
**Tags:** orbit-controls\
**Created:** [December 2, 2020, 11:42am UTC](https://discourse.threejs.org/t/orbitcontrols-on-damping-end/21173 "2020-12-02T11:42:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fluqz](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/fluqz/32/6279_2.png) [@Fluqz](https://discourse.threejs.org/u/Fluqz)\
**Post date:** [December 2, 2020, 11:42am UTC](https://discourse.threejs.org/t/orbitcontrols-on-damping-end/21173/1 "2020-12-02T11:42:29Z")

</div>

Hey, is it possible to get notified as soon as OrbitControls has finished moving with damping enabled?

The `end` event does not take damping in account. It gets fired on `pointerup`.

[https://jsfiddle.net/cLq6t4s7/6/](https://jsfiddle.net/cLq6t4s7/6/)

I, for sure, could check if mouse is up and the camera is moving in a certain frequency or sth like that, but that is too fragile. Or try to hack on the OrbitControls.js directly.

---

<div class="post-metadata">

**Author:** ![mjurczyk](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mjurczyk/32/10995_2.png) [@mjurczyk](https://discourse.threejs.org/u/mjurczyk)\
**Post date:** [December 2, 2020, 4:08pm UTC](https://discourse.threejs.org/t/orbitcontrols-on-damping-end/21173/2 "2020-12-02T16:08:19Z")

</div>

Judging by [this](https://github.com/mrdoob/three.js/blob/f62c3df3ad67ba01289a064a2d10db6ed078d746/examples/jsm/controls/OrbitControls.js#L145) - there’s probably no easy way to do it - most of the values and offsets are private, and there are no events fired just on movement.

What you mentioned at the end of your post may be actually a good way to achieve it though - when you receive `end` event from OrbitControls, just create a debounced event that’s not fired for as long as the camera is changing its position.

---

<div class="post-metadata">

**Author:** ![felixmariotto](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/felixmariotto/32/5928_2.png) [@felixmariotto](https://discourse.threejs.org/u/felixmariotto)\
**Post date:** [December 2, 2020, 4:29pm UTC](https://discourse.threejs.org/t/orbitcontrols-on-damping-end/21173/3 "2020-12-02T16:29:23Z")

</div>

I think the `change` event fires every frame during the automatic move with damping, and stops when it’s still.

Edit : well that’s pretty much what @mjurczyk suggested above

---

<div class="post-metadata">

**Author:** ![Raynor](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/raynor/32/15030_2.png) [@Raynor](https://discourse.threejs.org/u/Raynor)\
**Post date:** [December 10, 2020, 7:51am UTC](https://discourse.threejs.org/t/orbitcontrols-on-damping-end/21173/5 "2020-12-10T07:51:30Z")

</div>

I’d be very interested in this if it had mobile support, and most importantly, supported rotating and object as opposed to the current orbitControls which only supports a rotating camera. Having that as an option will make it a pretty solid contender [upsers](https://www.upsers.online/)

---

<div class="post-metadata">

**Author:** ![mjurczyk](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mjurczyk/32/10995_2.png) [@mjurczyk](https://discourse.threejs.org/u/mjurczyk)\
**Post date:** [December 11, 2020, 3:35am UTC](https://discourse.threejs.org/t/orbitcontrols-on-damping-end/21173/6 "2020-12-11T03:35:35Z")

</div>

Not sure what you mean, but to dampen object rotation (unrelated to orbit controls, which can affect only camera) you can use either a tween / animation library, or a simply a bit of math:

```javascript
const targetRotation = object.rotation.y + Math.PI;

animate = () => {
  object.rotation.y = Three.MathUtils.lerp(object.rotation.y, targetRotation, 0.1);

  if (object.rotation.y - targetRotation < 0.1) {
    // Do something when rotation is nearing it's target
  }
};

```

---

<div class="post-metadata">

**Author:** ![tomthebearded](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/tomthebearded/32/19132_2.png) [@tomthebearded](https://discourse.threejs.org/u/tomthebearded)\
**Post date:** [August 30, 2021, 1:21pm UTC](https://discourse.threejs.org/t/orbitcontrols-on-damping-end/21173/7 "2021-08-30T13:21:43Z")

</div>

the solution i found is to constantly take the azimuthal and polar angles values and check if they have changed
