Jump to content

ShiftedClock

Members
  • Content Count

    11
  • Joined

  • Last visited

About ShiftedClock

  • Rank
    Member

Profile Information

  • Location
    Edmonton, Alberta

Contact Methods

  • Twitter
    stevenvass
  1. Thanks John, I was searching the docs for "text" and "font", but overlooked the GUI module.
  2. I'm trying to display a simple text message like "Click anywhere to start" in my game. What is the recommended way to do this? Is CastorGUI the best way? Or is there a part of the normal Babylon API that I'm missing? Thanks.
  3. Hi, how do I make a UniversalCamera rotate on mouse move without the user having to click and drag on the canvas? Sorry for such a noob question, I just can't figure it out. Thanks.
  4. Good to know, thanks. Hopefully if/when someone runs into the same situation, something is there to say "Observables are not registered when using a WebGLRenderingContext." Either in documentation, code comments, or console warnings. Anything but failing silently with no indication as to why the Observables aren't being set up.
  5. Alright, I figured out the problem. This has been one of the most intense multi-day debug sessions I've had in years. After littering babylon.max.js with console.log statements, I narrowed it down to the fact that Engine._onCanvasFocus wasn't firing, while manually adding an event listener to the canvas focus event worked fine. Then I noticed, that code was wrapped in a check for canvasOrContext.getContext. Ding ding ding. Winner winner, chicken dinner, as the kids say. The problem was with this part of my code: let canvas = <HTMLCanvasElement> document.getElementById(
  6. Thanks for putting that Playground example together Wingnut. It's working for me, but my local Typescript implementation is still not working. Using window.addEventListener for the Action works fine: let yPress = new BABYLON.ExecuteCodeAction( { trigger: BABYLON.ActionManager.OnKeyDownTrigger, parameter: "y" }, () => { console.log("y pressed"); } ) window.addEventListener("keypress", (event) => { if (event.key === "y") { yPress.execute(); { }); That works. But doing this still does nothing: scene.actionManager = new
  7. I initialize an ActionManager and register an Action with it, using the OnKeyDownTrigger, like so: scene.actionManager = new BABYLON.ActionManager(scene); scene.actionManager.registerAction( new BABYLON.ExecuteCodeAction( { trigger: BABYLON.ActionManager.OnKeyDownTrigger, parameter: "y" }, function () { console.log("y button pressed"); } )); But when I press the "y" key on my keyboard nothing is logged to the console. I've tried with many others keys, in both Firefox and Chrome, after turning off all plugins. Typesc
  8. Thanks for the links. I'll play around with BABYLON.Animation, it seems like the more engine-friendly way of achieving what I want. So I'm going to make a base GameObject, and add components to it, such as the Mesh, and Animations. Although I'm not making a game right now, more of an animation study, but I still think in terms of GameObjects. Here's a video of a short game I made for a game jam a few years ago, that used raymarching extensively (i.e. nothing on-screen was rendered with a mesh). It was made in Unity, but there are certain technical abilities that I need for my upcomin
  9. Thank you so much. I'm just animating properties of objects, like so, in createSphere.js: let sphere = new BABYLON.MeshBuilder.CreateSphere("sphere", {diameter: 2}, scene); sphere.Behaviours = []; // Shoehorning the Behaviours array onto the Mesh object. sphere.Behaviours.push(function(deltaTime) { this.position.x += 0.001 * deltaTime; }.bind(sphere)); // Insert more "Behaviours" here, from a central file. sphere.Update = function (scene) { let deltaTime = engine.getDeltaTime(); for (let i=0; i<sphere.Behaviours.length; i++) { sphere.Behaviours[i](deltaTime);
  10. I'm new to Babylon, and am trying to determine how to use Observables for game logic in a frame rate independent way. I may be approaching this incorrectly, because there are many parts of Babylon that I'm unfamiliar with, such as Behaviours and Animations (so it may be an XY problem). Help would be much appreciated. In most game engines there's some deltaTime object, but I haven't been able to find anything similar to deltaTime in Babylons docs. In this example an observer is created that increments a global var alpha by 0.01 each frame. Ideally that would be alphaChange * deltaTime
×
×
  • Create New...