Toushin Posted January 30, 2015 Share Posted January 30, 2015 Hello, 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. Quote Link to comment Share on other sites More sharing options...
iiceman Posted January 30, 2015 Share Posted January 30, 2015 http://www.babylonjs-playground.com/#VI81O Maybe not the most beautiful solution but you could set the keyboard code values for the key to an unused value. camera.keysUp = [999999];camera.keysDown = [999999];Same for left and right of course. Hope that helped. Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted January 30, 2015 Share Posted January 30, 2015 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. Quote Link to comment Share on other sites More sharing options...
Temechon Posted January 30, 2015 Share Posted January 30, 2015 This solutions works correctly too : camera.keysUp = [];camera.keysDown = []; Quote Link to comment Share on other sites More sharing options...
iiceman Posted January 31, 2015 Share Posted January 31, 2015 @Temechon, of course... and it looks a lot cleaner, not sure what I was thinking @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. Quote Link to comment Share on other sites More sharing options...
Toushin Posted February 27, 2015 Author Share Posted February 27, 2015 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.