• Content count

  • Joined

  • Last visited

About Raggar

  • Rank
    Advanced Member

Recent Profile Visitors

849 profile views
  1. What weirds me out is the fact that the very first model I tried out, worked. I created it in 3Ds Max, but it didn't work properly before I imported the .obj model into clara.io and exported to .babylon. I believe they use the blender exporter. If only I had saved that model, I could simply edit it as it already had the right scale and position. Maybe changing the offset of the shape would work better than positioning the heightfield itself. The reason I'm not investigating this issue myself, apart from being grossly incompetent, is because I'm currently playing around with a racing game, and according to SO and Github, vehicles have many issues with heightfields. There are functions to find the height of the points/faces, and then keep the body over that y-position, but I believe this will create more issues with the vehicle mechanics. I tried Many of the previous versions of Babylon, with the same results.
  2. You can see the source code: http://www.gabrielgambetta.com/fpm_live.html I'm using this for one of my projects in 3D, and it works very well, even if it's discouraged to do this instead of applying velocities to the physics-bodies. You just have to validate the inputs, as there are still 2 ways to cheat using this: #1: Send bigger deltas. If you're delta is 0.016 and you instead send 0.032, you move double the distance. #2: Send more frequent updates. If you send 0.016 input deltas at 60Hz, you move the correct distance. What happens if you hack the client to send at 120Hz? You move at double speed again. You'll have to cap the number of received movement inputs for each second (+/- some packet loss). You'll have to limit the size of the delta timestamps, so if a client has a lag spike down to, let's say, 20FPS, this will be the absolute maximum size of the deltas, otherwise ignore them. You can combine these two, so that if you receive ~60 inputs per second, the maximum delta timestamp to process will be 0.016.
  3. @Wingnut I was talking about the post just before mine, yeah. Cannon.js has some issues when it comes to heightfields, (Especially) when run on Node.js. I tried a heightmap as well as data pulled from a 3D model. It's just too unstable on Node.js, unfortunately. At least when using vehicles. It's not that bad with normal bodies and velocities. So instead of using a heightfield, I use boxes and spheres to recreate the physics-bodies of the terrain. This is a slow and tedious task, but it's better than having your bodies fall through your heightfield. Why it is like that, I have no idea. I'm not smart enough to investigate
  4. I haven't had the pleasure to play with the shaderMaterial yet, si I really can't tell. Can you manually apply the texture and color to the shader, without the black effect? And I don't think cloning of materials is supported. You'll have to create a new material, using something along the lines of the same function you are using now.
  5. Couldn't you just run a function for every mesh that needs the cell shader, and do something like: mesh.material.subMaterials[1] = createCellShader(mesh.material.subMaterials[1]); var createCellShader = function(material){ var cMaterial = new BABYLON.ShaderMaterial(...custom vertex and pixel shader ); if(material){ if(material.diffuseColor){ cMaterial.diffuseColor = material.diffuseColor; } if(material.diffuseTexture){ cMaterial.diffuseTexture = material.diffuseTexture; } } return cMaterial; } Or did you have something else in mind?
  6. For the time being, I've chosen to use simple shapes instead of heightfields. This might be a option for you, too. I know it would be a lot easier to use either a map or a mesh, but I think the performance is better this way. Only speculations, though.
  7. Hmm. I might be missing something here. Look at my imported model: http://www.babylonjs-playground.com/#JZS611#1 The model has smoothing groups (From 3Ds max). Flat-shaded or smooth doesn't seem to make a difference. Might this be due to the way the model is exported or created in 3Ds max?
  8. The following functionality applies the current vertices' positions to the same vertices(No change to the mesh). var arr = mesh.getVerticesData(BABYLON.VertexBuffer.PositionKind); for (var i = 0; i <mesh.getTotalVertices(); i = i++){ var fx = arr[i * 3 + 0]; var fy = arr[i * 3 + 1]; var fz = arr[i * 3 + 2]; arr[i * 3 + 0] = fx; arr[i * 3 + 1] = fy; arr[i * 3 + 2] = fz; } mesh.setVerticesData(BABYLON.VertexBuffer.PositionKind, arr); I'm unsure as to how to apply a random noise, that still takes into account the vertices that are on the same position? If I use something like fx/fy/fz + a random value, the faces split up, and creates holes in the mesh.
  9. Like this?: var x = mergedMesh.getBoundingInfo ().boundingBox.Center; // Not sure this is right. I'm on my phone. y... z... var pivot = BABYLON.Matrix.Translation(x,y,z); mergedMesh.setPivotMatrix(pivot);
  10. does meshesGlobal contain All the meshes from the imported file? If you use the blender exporter, I think index 0 of the array is a root mesh without any geometry.
  11. Have a good one, bro.
  12. Let's say I have a material with the following properties: var ref = new BABYLON.CubeTexture("skybox", scene); var mat = new BABYLON.PBRMaterial("PBR", scene); mat.albedoTexture = new BABYLON.Texture("a.png", scene); mat.reflectionTexture = ref; mat.microSurface = .4; //mat.diffuseTexture = new BABYLON.Texture("s.png", scene); //mat.reflectivityColor = new BABYLON.Color3.FromHexString("#eeeeee"); //mat.albedoTexture.hasAlpha = true; //materialGloss.albedoColor = new BABYLON.Color3.FromHexString("#f00001"); Is it possible to have a texture on top of the reflecting surface? Preferably with an alpha channel. What about multiple textures layered on top of each other, like a dirt map on top of a logo?
  13. I've been through this without any luck as well. http://www.babylonjs-playground.com/#1PX171#23 In all those examples, I use the very first heightfield I got working using the function implemented in Babylon.js: For some reason, I've had a really hard time switching this heightfield with just about any other heightfield/mesh, This leads me to believe that the issue is with the createHeightmap function. Somewhere. Maybe the extentsize handling. I'm not at all sure. Cannon.js is known to have issues with heightfields, but I believe this is an issue with that function. If memory serves me right, I got it working only after exporting my model to clara.io, and then using clara.io's .babylon blender-exporter. Using 3Ds max' own exporter didn't work for some reason. In my example, look how much the heightfield in 'off' based on its scale: heightBody.position.y = -18; heightBody.position.x = -120; heightBody.position.z = 120;
  14. Let me revive my thread for half a second. I'm working on a smaller project right now, but a few days I thought up an idea that maybe should have been obvious from the beginning. I can use the same method I use to calculate the right velocity for my player body, based on rotation, to achieve this. But instead of applying velocity to the player body, I apply units to a simply physics body with a box shape and no mass or collision response. This way, all it takes is the rotation that is already being sent as well as the mouse pressed command. This requires traditional aimbotting to cheat, which is easier to spot as well. It's almost a shame, as my current hybrid model has hitboxes on head, upper body, lower, left lower arm, upper, right, leg, leg, etc. synched with the model, and I can't think of a performant way of recreating these server-side, while synching them with all the clients. Body, head and arms are relatively easy I believe. Problem is the animated parts like the legs. We'll see. I'm only a 1-man team, so simple hit boxes might be preferable for now.