• Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by Raggar

  1. It is discouraged to keep using this forum, instead create a thread at forum.babylonjs.com This seems to work: https://www.babylonjs-playground.com/#ASDN0P#2 I (think!) changing the transforms of a mesh only updates the boundingInfo, without creating a new one, so the reference bb1 gets updated as well, making both references bb1 and bb2 the same. Why the baking of transforms worked, I have no idea, but it seems to be needed in order to work in this example.
  2. Raggar

    New forum

    I gotta say, it saddens me to move from this forum I liked having some Phaser threads show up in the activity feed as well, even if I don't use Phaser myself. However, if Phaser is moving anyway, I'm on board with moving the BabylonJS activity elsewhere as well.
  3. I use the AssetsManager to load all my sounds, and put them into an array at predictable indexes. This way, I can clone the sounds and attach them to all players. /////Task var gunshotSound3 = assetsManager.addBinaryFileTask("soundTask3", "sounds/gs3.ogg"); /////onSuccess callback gunshotSound3.onSuccess = function (task){ var gs3 = new BABYLON.Sound("gunshotSound3", task.data, scene, null, { loop: false, autoplay: false, spatialSound: true }); sounds[2] = gs3; gs3.setVolume(0.6); } /////Player creation function player(gunIndex, ..., ..., ...){ ///gunIndex = 2; ... ...... ... ... this.gunSound = sounds[gunIndex].clone("gunSound"); this.gunSound.attachToMesh(this.mesh); } /////Gunshot sound needed player.gunSound.play(); /////New weapon etc. player.gunSound.dispose(); player.gunSound = null; player.gunSound = sounds[x].clone("gunSound");
  4. To my knowledge, cosserat rods are not supported out-of-the-box in Bullet Physics/AmmoJS. However, it seems like someone tried implementing it at some point:https://pybullet.org/Bullet/phpBB3/viewtopic.php?t=11242 Here's an Elastic Rod implementation as well: https://pybullet.org/Bullet/phpBB3/viewtopic.php?f=4&t=10993&p=36852 But these are all new concepts to me. If you want vehicle micro-destruction, Bullet provides you everything from the contact pairs, points, normals, applied impulses etc. So a vehicle-bone-rig would be cool with some swapping of models as well. You can create your vehicle body out of smaller shapes and use hinges on doors etc. Or you can simply use a model as cosmetics. You'll most likely use a compound body anyway, since it's the easiest way to create an artificially lowered center of mass. Would be cool to see a game like that.
  5. Here's an example of the FreeCamera: https://www.babylonjs-playground.com/#XPCUMC Using the lockedTarget property. I think this might be your issue with the other cameras as well.
  6. I honestly have no idea. Your issue was different than mine. It was sort of a brute-force approach finding a solution.
  7. I'm using the bone functions getPositionToRef() and getRotationToRef() to sync hitboxes to bones. If you went down this path, you would help others using the Blender exporter as well You would have to somehow use the rotation in Blender to fix the rotation in BabylonJS, though, as as you say, the rotation in BabylonJS is different from that of Blender. I think the model in BabylonJS inherits the rotationQuaternion of the bone. You would either rotate the model/hitbox each frame, or take the difference from Blender and BabylonJS and apply this before attaching the model to the bone.
  8. Heightfields are generally more performant, but lacks features that concave shapes have. If you are creating a giant island-map, you'll want the extra performance of the heightfield, if all of the map is to be used for collision detection and dynamics. If you, however, want to create a racing track, a heightfield could result in A LOT of unused geometry in your physics shape. In this case a concave shape would be more performant, and allow for such features as holes in the ground, which heightfields do not. Generally, if you want dynamic concave shapes, you are way better off converting to/generating a compound body of convex shapes. It all really depends on your project, and there's no reason not to use both heightfield, concave, convex and primitive shapes all at once. You'll squeeze out some extra performance if you groups all static shape types together as well, making big compound bodies out of all static concave shapes, making compound bodies out of all static convex shapes, etc, etc. <- Same thing with CannonJS.
  9. In 3Ds Max, try changing the pivots for all the meshes to "Center to object". You can do this by simply selecting everything at once.
  10. I can't open your max file since I'm outdated at the 2015 version. Deleting the cloth fixed the artifacts for me, but another thing did as well. Can you confirm this works for you, too?: - Select the cloth mesh - In the skin modifier, remove all but the weighted bones, leaving you only with the backflap_.......... frontflap_... bones.
  11. I've had similar issues with Max. Back then the issue happened if a vertex wasn't weighted properly. A single non-weighted vertex would create artifacts. I haven't tested your file, but try weighting ALL vertices 100% to a single bone. If this solves the artifacts, you can be pretty sure that it's a weighting issue. Edit: My issue actually looked different. Will try it later tonight.
  12. Does .position and getAbsolutePosition() match? As Brian pointed out, it might very well be that the pivot points of the meshes are offset from 0,0,0. This can happen in the 3D-modeling software when you export, reset transforms etc. but is useless if you plan on animating the individual models. You can open your model in Blender, or use BabylonJS to change the pivots to the center of the different meshes.
  13. I recently ported the physics engine of an "old-ish" BabylonJS project of mine from CannonJS to AmmoJS. I did this as CannonJS is no longer maintained, has buggy convex collisions and a limited concave implementation. AmmoJS can be compiled to WASM as well, which is no doubt the way things are moving when it comes to physics. Chrome even just started their trial for WASM threads. I'm using a worker, though, as my game requires every bit of juice it can possibly get. I won't have time to help with the plugin, and you know.... What is TypeScript? .. But I really think AmmoJS should be included as a plugin, as well as the playground, as it is a beast. Just make sure to re-use quaternions, vectors, transforms etc. as AmmoJS otherwise leaks and builds up memory pretty fast. I think a proper implementation will be far superior to what BabylonJS already supports.
  14. https://playground.babylonjs.com/indexStable.html#PN1NNI#98 In the exporter - at least the one for Max, models are exported with the rotationQuaternion property set. When this is the case, .rotation is not used. Either null out the rotationQuaternion, or rotate the model/clone using one of the methods that supports quaternion rotations.
  15. Ask him when we'll see him aboard the Orville
  16. If only I could remember what I did to fix the positioning. I ended up using a ribbon instead of a ground. This way, I create the ramp shape based on 4 clicks/picks. One for each corner. http://www.babylonjs-playground.com/#GQ83J#10 Click 4 times to create the ramp.
  17. Why not do it in blender, since you already have the file on hand? All you have to do is create a new bone without any vertices/weights assigned to it and place it right where your pivot should be(right above your Body bone). You link the head, arms and gun bones to this bone, and then link this bone to the Body bone. Then the skeleton will behave as before, while giving you the opportunity to transform the upper body using one control point. If it Has to be done in BabylonJs, then that is possible as well by creating a new bone, and doing the same thing as discussed above: https://doc.babylonjs.com/api/classes/babylon.bone#constructor
  18. It will still work without that function. You might have forgotten setting an emissiveColor?
  19. You have a few options to choose from. Every frame, you can set the Y velocity of the physics body to 0. You can also apply a constant upward force of the same value as the gravity. Or you can set the gravity to 0, and then apply downward forces to the bodies you need to apply gravity to. Another thing is to take the wanted position, let's say (14,20,32), and use this to calculate a direction vector based on the current position and the wanted position. Then you apply this vector as your force, to constantly keep the body moving toward the direction. The farther it is from the position, the faster it will go. That behavior can be prevented by scaling the vector by some static value, though.
  20. The glowLayer works fine with created meshes. http://playground.babylonjs.com/#IEW571
  21. Raggar


    I tried that in other games. Never understood why invert_pitch invert_yaw invert_roll
  22. Raggar


    https://raggar.co/dronez/ [WASD]+Mouse I needed a break from my multiplayer game, so I spent a little over a week making a little mini-game. Created using BabylonJS and CannonJS. No objectives. Just shoot the enemy AAs and drones. - Tested on Chrome and Firefox @ Windows - There's a bug resulting on some AAs being invincible. - Much of the code could be rewritten and optimized. I actually made a tank as well as a jet, so I might revive this project at some point. I have a little 2-day mini-project in mind first, though.
  23. You have to create an HTML element and assign it an ID of "fpsLabel". <div id="fpsLabel"></>
  24. You can change the direction of all the individual particles. Change them to a direction vector based on the positions of the particles and the emitter, like this: https://www.babylonjs-playground.com/#WBQ8EM#11