Jump to content

Disabling keyboard events


Recommended Posts



I am using an ArcRotateCamera for my scene right now.


I want to prevent the Bayblon.js canvas from reacting to key-events, while retaining all functionality from mouse-events. I have tried various ways to accomplish this, like giving the canvas onkeydown and onkeypress events that return false or unbinding all eventhandlers for this canvas, unfortunately all without success.


Maybe I am overlooking something obvious, but I already spent 2h on this, so I thought I better ask here for some ideas.

Link to comment
Share on other sites

It is Friday afternoon, so I am not going to check I am right before I reply or make you wait.


Setting the activeCamera does JUST that.  


Attaching the camera to the scene does different things, based on the camera.  Setting up keyboard control is one of those things.  Comment out that line, and see if the result are what you want.

Link to comment
Share on other sites

@Temechon, of course... and it looks a lot cleaner, not sure what I was thinking :P


@JCPalmer If you don't attach the camera you don't get the mouse control. If I got it right he wants to keep the mouse control and just disable keyboard events.

Link to comment
Share on other sites

  • 4 weeks later...

Sry for my late reply, I was very busy and just now could get back to this problem ^^


I marked Temechon's answer as the solution, since it works as I intended, is clean and doesn't force me to change the babylon source code.


Nevertheless, thanks to all people involved.

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...