Jump to content

Camera Input state observables


Recommended Posts


I have an animated ArcRotateCamera who's animation should pause quietly on user input (through PointersInput).
At the moment the input components do not announce state changes.
I think at the very least, input types should have a `get state` & an `on state change`.
IMO the input system could use a rewrite.

Link to comment
Share on other sites

Custom controls with objects are fine.
The problem is that the built-in camera input objects don't use the actionManager pattern and don't raise events, They just hook themselves to the DOM.
I want to be able to do something like:

var cameraAnimation = scene.beginAnimation(camera, .....);
camera.inputs.attached.pointers.addEventListener('onusercontrol', function() { cameraAnimation.pause(); });

Without having to rewire the entire input component.

Link to comment
Share on other sites

This is what I ended up doing, I copied the ArcRotateCameraPointersInput and added 2 events and used them like this:

var cameraAnimation = .....

camera.inputs.attached.pointers.onUserInteraction = function() {
  cameraAnimation && cameraAnimation.animationStarted && cameraAnimation.pause();

var idleTimeout = null;
camera.inputs.attached.pointers.onIdle = function() {
  if (idleTimeout) clearTimeout(idleTimeout), idleTimeout = null;
  if (cameraAnimation && !cameraAnimation.animationStarted) idleTimeout = setTimeout(function() {
  }, 500);
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...