JBP

Members
  • Content count

    18
  • Joined

  • Last visited

  1. Like this: http://www.babylonjs-playground.com/index2_5.html#2ENPZ7#6 just init camera like this: var camera = new BABYLON.ArcRotateCamera("Camera", Math.PI / 2, 1.0, 110, sphere.position, scene);
  2. Physics Worker

    Hello, but this if for the build in collisions right ? I asking for the oimo or cannon plug-in is the "world.step()" function called inside a Worker ?
  3. Physics Worker

    Hello, can anyone tell me if the current implementation of the Physics engines (oimo, cannon) support Web Worker or its a single thread implementation ?
  4. Found the solution, the problem is not in BabylonJS the problem is in this lines of code: hero.physicsImpostor.physicsBody.fixedRotation = true; hero.physicsImpostor.physicsBody.updateMassProperties(); I was creating a Cylinder and fixing the rotation so that the cylinder was always up, if remove these lines and replace the Cylinder with a Sphere starts to work Thanks for all the help !!
  5. Found the solution, the problem is not in BabylonJS the problem is in this lines of code: hero.physicsImpostor.physicsBody.fixedRotation = true; hero.physicsImpostor.physicsBody.updateMassProperties(); I was creating a Cylinder and fixing the rotation so that the cylinder was always up, if remove these lines and replace the Cylinder with a Sphere starts to work Thanks for all the help !!
  6. @Deltakosh Hello I have update the playground with no physics and the hero goes always straight. http://www.babylonjs-playground.com/#1AFY3M#3 So I don'y know if this is a BabylonJS bug or a Physics Bug I have tried OimoJS also and the result is the same.
  7. @Pryme8 OK cool, but how do I do that ? Or can you update my playground ?
  8. @Raggar is correct Ok you are correct but the problem is before the collision. At the start if you aim at the box and press W it goes straight to the box. But if at start you go straight (W) for 1 - 5 seconds and then you aim at the box and press W its does not go straight to the box it goes sideways. Its a problem difficult to explain to you think a video can help ?
  9. Sorry i don't understand what you wrote. There are only three meshes with physics the hero, ground and the box. There sphere that appears in the middle of screen is just an aim sight, so that the user know where its shooting, and was no physics enabled.
  10. Hello, thanks for the reply there are two examples: http://www.babylonjs-playground.com/#1AFY3M#0 http://www.babylonjs-playground.com/#1AFY3M#1 The control works but the problem is that the camera/hero doesn't go straight forward all the time. For example if at start I point at the Box at the top left if and only press 'W' it goes straight to the Box, but if I for example go straight 'W' for 1-5 seconds and then point at the Box and press 'W' the camera/hero doesn't go straight to the BOX, it goes sides ways.
  11. Hello I have submit a question in the Questions & Answers sections: But I my problem is not in decode but in the BABYLON.JS Resume: The control works but the problem is that the camera/hero doesn't go straight forward all the time. Example if at start I point at the Box at the top left if and only press 'W' it goes straight to the Box, but if I for example go straight 'W' for 1-5 seconds and then point at the Box and press 'W' the camera/hero doesn't go straight to the BOX, it goes sides ways. Can anyone please check this out ?
  12. Thanks for the reply, and I sorry for insisting on this topic, but I copied the best I can the example you speak about: https://github.com/Pryme8/TERIABLE/blob/gh-pages/Infinity/teriable-infinity-0.0.1.js And updated the Playground http://www.babylonjs-playground.com/#1AFY3M#1 but still I can't get it to work correctly. I'm sorry for being such a "pain in the ass" but I just can't figure this one out. Thanks in advance.
  13. Uploaded a example to http://www.babylonjs-playground.com/#1AFY3M#0 The control works but the problem is that the camera/hero doesn't go straight forward all the time. Example if at start I point at the Box at the top left if and only press 'W' it goes straight to the Box, but if I for example go straight 'W' for 1-5 seconds and then point at the Box and press 'W' the camera/hero doesn't go straight to the BOX, it goes sides ways. Where is an example using THREE.JS and CANNON.JS of the kind of movement I want: http://javascriptjamie.weebly.com/bouncy-colorful-boxes-game.html Can any one help me, or in alternative point me to and example First Person Example using BABYLON.JS and CANNON.JS. Can any one help me, please. I want to use BABYLON.JS for my projects.
  14. Physic with camera not working

    @smatt Hello donĀ“t know if you found your solution but I have the same problem and found this solution: If you have found a better solution please share
  15. Hello I am trying to develop a FPS using BabylonJS and CannonJS in TypeScript. My first problem was what type of Impostor to use as the player, end up using a Cylinder with a FixedRotation = true. Now I place the camera on top off the Cylinder on every frame, and apply Impulses to the Cylinder based on keyboard input, and camera target. The algorithm that I came up is the flowing (hero = Cylinder): scene.registerBeforeRender(function () { //Your code here //Step camera.position.x = hero.position.x; camera.position.y = hero.position.y + 1.0; camera.position.z = hero.position.z; let camFront = camera.getFrontPosition(1.0); let vecFront = camFront.subtract(camera.position); vecFront.normalize(); let finalVector = new BABYLON.Vector3(0.0, 0.0, 0.0); if (moveForward) { finalVector = finalVector.add(new BABYLON.Vector3(1.0 * vecFront.x, 0.0, 1.0 * vecFront.z)); } if (moveBackward) { finalVector = finalVector.add(new BABYLON.Vector3(-1.0 * vecFront.x, 0.0, -1.0 * vecFront.z)); } if (moveRight) { let q = BABYLON.Quaternion.RotationAxis(BABYLON.Axis.Y, BABYLON.Tools.ToRadians(90)); let m = new BABYLON.Matrix(); q.toRotationMatrix(m); let vecRight = BABYLON.Vector3.TransformCoordinates(vecFront, m); vecRight.normalize(); finalVector = finalVector.add(new BABYLON.Vector3(1.0 * vecRight.x, 0.0, 1.0 * vecRight.z)); } if (moveLeft) { let q = BABYLON.Quaternion.RotationAxis(BABYLON.Axis.Y, BABYLON.Tools.ToRadians(-90)); let m = new BABYLON.Matrix(); q.toRotationMatrix(m); let vecLeft = BABYLON.Vector3.TransformCoordinates(vecFront, m); vecLeft.normalize(); finalVector = finalVector.add(new BABYLON.Vector3(1.0 * vecLeft.x, 0.0, 1.0 * vecLeft.z)); } finalVector = finalVector.normalize(); hero.physicsImpostor.applyImpulse(new BABYLON.Vector3(15.0 * finalVector.x, 0.0, 15.0 * finalVector.z), hero.getAbsolutePosition()); }); Is there a more effective way to do this ? Thanks in advance.