At some point, the way firefox handles keyboard events changed. I’m not sure exactly when it happened, all I know is that it broke how I was dealing with keyboard interaction on almost every demo I’ve written (for example,the mocap demo and MotionView). When I wrote the demos, the keydown event would be fired once, when the user initially pressed the key (it still works this way on the other browsers as far as I can tell), but at some point that I missed it got changed to firing on every update for as long as the key is held (or until you press another key, at which point the keydown event will start firing repeatedly for that key). Several of the demos and tests I have written relied on the keydown event to start moving something in the scene (usually the camera). Unfortunately, when the event switched over to firing repeatedly as long as a key is held, this caused uncontrollable acceleration which could only be countered by holding a key for the opposite movement a corresponding amount of time.
I accommodated for this by adding a check into the function that handles that event to compare the key most recently pressed to the previous key pressed (which starts off as a value of -1, and must be reset to that whenever the most recent key pressed is released) and only causes the movement if they do not match. I think I’ve added this into the various demos that require it, but if you find any of them have weird camera movement that just doesn’t behave right, let me know in the comments.
The 2.2 Release of the Canvas 3D Library includes a number of new features, updates to old features and fixes for several bugs along with the requisite changes to meet the evolving WebGL spec.
Some of the things included (in no particular order) are:
- Better picking code.
- The ability to swap textures as a scene is running.
- The ability to texture an object with video files and canvas tags.
- More information about objects, such as the number of triangles, the size of the object (and the ability to scale it to a particular size) and the ability to center an object.
- Primitive objects such as cubes, planes and spheres.
- Upgraded collision detection.
- The ability to pause/stop/start the scene (rendering and updating).
- The ability to label an object in the scene as static, so time won’t be wasted trying to calculate the movements of an object that does not move.
- Using RequestAnimationFrame so as not to waste time rendering a page that isn’t visible.
- Frustrum culling.
- General improvements to the performance of the library.
We have a number of other changes coming, along with new tutorials and demos planned. And as always, you can request new features and/or report bugs through our lighthouse account
As WebGL is implemented and refined by various browser makers, things that were once working for c3DL has been broken. This 2.1 release is made without new features but will hopefully address some of the new issues that have come up. On October 27, the Level Up Game Jam will be held at Seneca College (Seneca@York campus) as part of Toronto Open Source Week. A set of small tutorials on tools that can be used to develop games for the open web will be presented in the morning. In the afternoon, attendees are encouraged to break out into small groups (or by themselves) to make games with these tools. Tutorials Topics and Facilitators:- Andor Salga – processing.js
- Catherine Leung – c3DL
- Alistair MacDonald – web audio
