Jump to content


  • Content Count

  • Joined

  • Last visited

About splash27

  • Rank
    Advanced Member
  • Birthday 10/20/1990

Profile Information

  • Gender

Recent Profile Visitors

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

  1. My solution: https://www.babylonjs-playground.com/#RAYW6X#3 It's a little bit similar with solution by @Raggar, however less expensive and more universal (I think). Yeah, the main disadvantage is simplifying physics till bounding box, but it can be accepted in my case. Anyway, it still looks like a hack. I wonder if merging algorithm can be fixed inside Babylon's core.
  2. In a shooter game I can calculate the vector with direction that player look at. This vector can be used to guide the bullet. But in this case the weapon will have 100% accuracy. I want to add a random angle (within limited range) to this vector to simulate accuracy less than 100%. So, the question is how to get rotated vector in 3D space?
  3. Hi, Wingnut. I don't know why you always have troubles with pounterLock. This part of code allows me to use free mouse look. Now what about Long Range Weapons (LRW). I can mark 3 following approaches (or even archetypes). 1. Laser. Instant damage at the point of intersection, or projectile teleportation. It's pretty good for laser cannons or probably sniper rifles. But it's not suitable for rockets, fireballs and other slow projectiles. Also I don't want to use it for regular firearms. Because even in real life you're still have a low chance to evade from pistol bullet. So, I d
  4. What about collision detection in animatable object, I made the following solution: http://www.babylonjs-playground.com/#RS8SCE#3 It works and it's pretty stable. It should has a less amount of bullet-thru-wall issues, because animation and collision checking occurs in the same rendering loop. However it may cause performance issues in case of big amount of meshes in the scene. We could try to reduce intersection loop. For example, we can exclude walls, floors and ceils from the loop and check intersections with them by checking current coordinates of the rocket. Its possible, becaus
  5. If dropped pistol will act like a box in Physics world this is not a big problem in my simulation. It should looks like compound shape however the box-like colliding is a compromise that I can accept. How to do this?
  6. Ok! Thank you again! Seems like I have to learn this field more carefully before proceed. Is CCD-active CannonJS some kind of fork of official CannonJS? Where can I get the last version of it? Also are there some tutorials how to use BabylonJS with native CannonJS? Since the Impostor system doesn't work here.
  7. @WIngnut, @Raggar, thank you, guys! I'll try to adopt your investigations to my case. I also faced the problem with bullet-thru-target issue on high velocities. I even thought about openning new topic for this :) Increasing physical timestep might help a little bit. However if I increase the power of the ball from 70 to 100 in Wingnut's last example, no further increasing of timestep helps. This is not a problem if I will destroy the projectile right after colliding, however for some other simulations this might be a problem. Also, the issue with handling 'collide' event in animatabl
  8. @Raggar, great! However parenting system is not comfortable in cases of spawning instances. You'll have to create instance for every child and attach impostor for every child. Can I fix halfExtents manually after merging meshes? If yes, how I can do this? I can't find such property in Impostor's properties.
  9. The problem is here: https://www.babylonjs-playground.com/#RAYW6X My mesh partially goes through the floor while the physicsImpostor is applied. Can I correct it's behavior on my mesh?
  10. Any ideas how to catch collide event? I tried to do this without animation also. But even when I use physical engine the onCollide handler didn't fire.
  11. I did it! Almost at least. My solution is here: http://www.babylonjs-playground.com/#RS8SCE#1 I just calculate the final destination of the projectile and use Animation to make it move from spawn point till the end point. I also destroy projectile after maximum distance travelled (mind the memory, huh). However, there is still a problem. I can't detect the collision between projectile and any other mesh during the flight. This doesn't work for some reason: instance.onCollideObservable.add(function (mesh) { console.log("collided"); });
  12. What about gravity force compensation? Will it works? I want to applyForce to every projectile instance. The force will be equal to gravity however it will be directed to opposite direction. I try to add this after setting linear velocity: instance.physicsImpostor.applyForce(new BABYLON.Vector3(0, 10, 0), instane.getAbsolutePosition()); However I can't see any changes. How applyForce() works? Will the force be applied forever (like gravity) or it will be applied only during first physical step(s)? Is it possible at all to compensate gravity during all lifetime of the mesh (imp
  13. I implemented it as it implemented now in my app. Here is playground: http://www.babylonjs-playground.com/#RS8SCE The trick with instance.setParent(null); works. However, there is another problem. The projectile with zero mass will not fly. I want to make a rocket that will ignore gravity, however I want to keep gravity working for another physical objects that may be placed into the scene. Is there a way to exclude gravity affection for particular physical object? As I mentioned before, setting mass to 0 doesn't work.
  14. Faced new problem. Here is a function that spawns a projectile near player's camera, calculate a vector between point of view and placed projectile and launch the projectile to the flight. launchProjectileInstance(actor) { let instance = this.projectile.createInstance(); instance.parent = actor.playerCamera; instance.position = new BABYLON.Vector3(0, 0, 1.5); instance.rotation = new BABYLON.Vector3(Math.PI/2, 0, 0); instance.isVisible = true; instance.physicsImpostor = new BABYLON.PhysicsImpostor(instance, BABYLON.PhysicsImpostor.Cylind
  15. Ok, seems like I understood the basics. However, there is still one question. How I can determine the direction of vector that I need to pass to setLinearVelocity()? Initially, the bullet should fly towards the point that I am looking at.
  • Create New...