Jump to content


  • Content Count

  • Joined

  • Last visited

  1. Answering my own question... The solution I came up with was remove the event listeners from the InputText, and add a 'keydown' event listener to the canvas. Then in the canvas' keydown event, if the user presses enter, I process the chat input's current text and then clear it. Otherwise, I call the InputText.processKeyboard(e) method, with e being the KeyboardEvent passed via the onkeydown event, and let the InputText control process it from there. private _chatInput : GUI.InputText; ... document.getElementById('canvas').addEventListener('keydown', this._handleKeyDown.bind(t
  2. onBeforeKeyAddObservable doesn't pick up Enter presses, and onBlurAddObservable doesn't differentiate between the user pressing Enter and clicking outside of the TextInput. What I'm trying to do is have a chat box, so that the user can send the message simply by pressing Enter; but I can't find a way to determine when the user actually presses Enter. Thanks
  3. Thanks for the tips. After trying to 'overlap' the edges of each chunk, I too had an issue with shading, particularly areas where the slope was steep. After some fiddling around, I managed to find another solution. What I did was created another canvas element on the document, as well as an image element to store the entire height map. Then I draw the image onto the canvas, based on which part of the map needs to be loaded https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/drawImage (the canvas' context's API makes this very easy). Once the image is drawn on t
  4. I have a rather large map, and am therefore loading it in chunks 16x16 units in size. At any given time, there are are a total of 25 chunks loaded in a 5x5 grid. Each chunk has its own mesh, created using BABYLON.Mesh.createGroundFromHeightMap, and then I position the ground meshes at the appropriate locations. To create the height maps, I took the original map and cut it into chunks as well, and then pass it to each chunk. However, the edges of the ground meshes do not align, particularly if the edge has a steep slope. I attached a screenshot to better understand what I'm talking ab
  5. Is there a way to suppress the warnings when compiling, for example, As far as I'm aware, I don't need to use any functionality cannon, earcut, or oimo (i'm getting warnings for all 3). If it matters, I'm using VSCode, TypeScript, and webpack-dev-server for my development environment. Thanks
  6. RIght, and actually the issue was with my code, and not with the call to getHeightAtCoordinates. Nonetheless thanks for the quick response Edit: Sorry, I can't get the PlayGround to load right now, so I can't check out the source code (I'm in China so my internet isn't the quickest at times)
  7. I'm new to BJS, so I apologize if this is such a basic question. I have created a ground with a heightmap, and I am simply wondering how can I make sure all entities remain on the ground? Note that there is no physics in my game, so no jumping, etc. In other words, entities will always be 'stuck' to the ground. Right now when creating entities, I am using Vector3 and setting their Y value, but since I am using a heightmap this Y value obviously needs to be dynamic, depending on its current location on the ground. I was looking here at this link https://doc.babylonjs.com/babylon101/cameras
  8. Sorry to bump an older topic, but I too am unable to change (lower) the speed of the ArcRotateCamera. Setting the speed property doesn't seem to have any effect
  • Create New...