BeanstalkBlue

Members
  • Content Count

    45
  • Joined

  • Last visited

About BeanstalkBlue

  • Rank
    Advanced Member

Contact Methods

  • Twitter
    scarlet6game

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Actually a coincidence of two things happened, making me think there was a problem that wasn't really there: 1) I had a bug in my original code, where keyboard presses really did interfere with mouse movement. 2) I fixed that bug, but I was travelling with my laptop and stopped using a mouse (was using a trackpad instead). When I did this, I didn't realize that my trackpad driver disables the trackpad temporarily when you press a non-modifier key on the keyboard . It's a feature to prevent resting your palm on the trackpad causing unwanted cursor movement while typing. So basically my code works now and it attaching eventListeners to the window works fine. Maybe at least this will help someone else if they ever google this haha
  2. That is the problem. I need to control camera with the mouse, and handle input events from the keyboard at the same time. This seems like a really basic requirement for many games, so Babylon must have this, I think? Here is a simple playground displaying the problem: http://www.babylonjs-playground.com/#1MK1Y4#1 Pressing "w" key moves the mesh. You can't move the camera with the mouse at the same time as moving the mesh. Edit: Actually is this maybe just my laptop? I don't have a mouse with me at the moment. Can you guys move the mesh while controlling the camera with mouse or is it just me that can't with my touchpad?
  3. I have read all of the camera inputs articles in the docs and I have tried to find a demo, but I can't seem to figure out how to add inputs to control objects other than the camera in Babylon. I have tried to manually add a keyboard event listener following Temechon's Infection code, but that doesn't work, as it interferes with camera input (either camera input will work or my inputs will work, but not both at the same time). Here is part of Temechon's code from https://github.com/Temechon/infection/blob/master/ts/Player.ts // Keyboard events this._handleKeyDownCall = this._handleKey.bind(this, 1); this._handleKeyUpCall = this._handleKey.bind(this, 0); window.addEventListener("keyup", this._handleKeyUpCall); window.addEventListener("keydown", this._handleKeyDownCall); Should I instead just implement my own ICameraInput and then put all of my game controls inside of this? It feels strange to have all game input inside of the camera. The controls don't control only the camera. But is this what Babylon experts usually do? It seems like this could create a problem when you switch from one camera to another. Is this meant to be done with the ActionsManager?
  4. I have point shadows on SPS particles (which I guess are instanced meshes), and it works fine. Maybe there is something going on with the meshes you are adding to the shadowGenerator renderList? Did your instanced mesh error occur after using my code? If so then just to check, set minZ and maxZ in setShadowProjectionMatrix() to something sensible manually (like 0.1 and 100.0) and see if that changes anything.
  5. What I am trying to say is that the Babylon.js function here: public setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): PointLight { var activeCamera = this.getScene().activeCamera; Matrix.PerspectiveFovLHToRef(Math.PI / 2, 1.0, activeCamera.minZ, activeCamera.maxZ, matrix); return this; } Should be this: public setShadowProjectionMatrix(matrix: Matrix, viewMatrix: Matrix, renderList: Array<AbstractMesh>): PointLight { Matrix.PerspectiveFovLHToRef(Math.PI / 2, 1.0, this.range/1000.0, this.range, matrix); return this; } Unless I am missing something? "activeCamera" is not the shadow generator's camera, it is the camera that the player sees the world through, right?
  6. I noticed that the shadow generator for point lights sets the shadow generator camera matrix using the activeCamera.maxZ (in .setShadowProjectionMatrix()). It should really use the point light's range, to have better depth z accuracy since there are no shadows further than the light's range anyway. It is also using the activeCamera.minZ, which is too far (at least in my case) for the shadows, and causes light bleeding. Can I set this or do I need to override the setShadowProjectionMatrix function like this: BABYLON.PointLight.prototype.setShadowProjectionMatrix = function (){ [...] } Or is there a better way? If I am right then I would submit a PR but I am new to Babylon (and Javascript and Typescript) so I thought it is better to ask here instead and let you guys fix it since it is a 1 line change in BabylonJS code.
  7. Oh, haha. Embarassing. I was setting height on the canvas but not on the parent div. Thanks as usual @Deltakosh
  8. The CSS and the problem I describe can be seen in the app here: https://scarlet6.com/pre-alpha/
  9. Hmm, I have that. When calling fullscreen I press F11 in my browser. But as you can see from screenshot #2 above, the canvas also resizes when I open the inspector, and it doesn't fill the screen, it stays at exactly 2.0 aspect ratio. (You can also see I have width:100% and height:100% in my #renderCanvas CSS. I copied the Babylon Demo CSS. No matter what size I make the window, the canvas is 2:1 aspect ratio (height = 2*width). Is there maybe code that I wrote that controls this?
  10. When I am fullscreen the canvas is not 100% height even though my CSS makes it that. When I resize the window the canvas height:width is always 2:1. Did I set code that makes this happen somewhere that I forgot? I searched everywhere but can't figure this one out. It seems like my code is the same as the babylon website Demo code, so I dont understand See attached images:
  11. I tried offsetting the heights randomly by a little bit. Attached image of exaggerated version of what happens (big offsets). It is much worse I could try to not render side walls I guess, that's a good idea. But actually I dont know if the problem is with side walls or just the edges touching. For that I guess I need to duplicate every particle so there are two different models available for each position (so I can have some particles in the mesh still have walls), and then only draw half the particles.
  12. This is scene is arranged into separate blocks, each block is a SolidParticleSystem. (Like this, and like this.) Each particle is touching right on the edge (see attached image), or click here. There are some black pixels that flicker in and out on these edges. These are z-fighting artifacts on the edges (I think ). I tried just increasing the scale of the particles slightly so they overlap with each other but this doesn't fix it. What can I do to remove these artifacts? Is there a simple way without adding more geometry to every particle? I'm not afraid to modify shaders if I have to.
  13. let mat1 : BABYLON.StandardMaterial = new BABYLON.StandardMaterial("mat1", scene); let mesh1 = new BABYLON.Mesh("mesh1", scene); mesh1.material = mat1; mesh1.material.opacityTexture = null; // '<-- This is not allowed.' In this situation TypeScript complains that we can't set opacityTexture because mesh1.material is of type BABYLON.Material (not BABYLON.StandardMaterial). I could of course just do "mat1.opacityTexture = null", but what is the typical way to handle this type of situation in TypeScript if I really want to access the material via "mesh1.material"?