Search the Community
Showing results for tags 'physicsimpostor'.
-
Hi, I am new to babylonjs (and physics libraries in general). I have made a demo to illustrate my problem https://playground.babylonjs.com/#1XWKCR#1 I am trying to model a square grid that behaves like there is space in the middle, as in, if an object happens to be in the middle of it, the grid should be hanging onto it. Following the example here https://playground.babylonjs.com/#66PS52, I have created 4 boxes, positioned 90deg to each other, added a PhysicsImpostor.BoxImpostor, and parented them under a physicsRoot with PhysicsImpostor.NoImpostor. The grid behaves like there is only one collider, right in the center of the grid. Can someone please explain what is going on there? Thank you, vinz
-
Language: TypeScript Physics Engine: CannonJS Hey all, I would appreciate it if someone would help me solve these 2 mesh physics problems that I feel are related. I spent a lot of time trying to solve these related issues on my own and could not figure out what was going wrong. RELEVANT NOTE: BOTH problems occur right after switching from 1 scene to another scene. They only happen right after a scene loads. I have a video that demonstrates the error below. Problem 1: After loading each mesh (each with its own physics impostor), each mesh jumps a little (and then afterwards, they start falling because of gravity). I was wondering why/how to prevent it from happening. Note: I suspected that it is because they load too close to the ground and bounce because the computer erroneously thinks that the meshes/ground are touching. I am able to lessen the jump by making the ground’s position.y = -0.5 (so it is even clearer to the computer that the objects are not touching because all objects right now load at position.y = 0 (and I move objects before the next object loads so they don't intersect and start a collision)), but the jump still occurs, just less of a jump and still noticeable. Problem 2: After loading a certain scene, after being loaded, each instance of a special object I created (a class I created that includes a mesh) jumps in opposite directions from each other. I’m not sure why. I have a feeling it has to do with having multiple instances of the same class, each with their own mesh. After the scene loads, I am able to individually access each mesh and have them move individually, so their movement isn’t intertwined. Code/Video in Link: Relevant code and 1 video demonstrating error are in the Dropbox link. Note: The video shows both errors happening at the same time. Note: The code in this folder are not in the same directory/folder structure that I normally use for this program (so that is not the cause of my issues) [Link Removed] Thank you to all who read/and might help me with this issue!
-
Is it possible to add a physics impostor to a free camera with cannon.js that allows it to collide with rigid bodies just like any other mesh that has a physics impostor? I also need the free camera to maintain the standard keyboard/mouse controls.
-
I have a mesh imported from .babylon file, and it has its animations. I put MeshImpostor in, expecting it to update with the animation, but it's not. It seems like it uses the first frame as the reference to the collision detection. Is there any way to update it? Code is something like this: var mesh = scene.meshes[0]; mesh.physicsImpostor = new BABYLON.PhysicsImpostor(mesh, BABYLON.PhysicsImpostor.MeshImpostor); //I tried to force it update it too, but doesn't seem to work. function update() { mesh.physicsImpostor.forceUpdate(); }
-
Hi! Like I said in another topic I have a problem with parenting pyhsicsImposter and thier collides. I finally prepared a playground to show the problem! http://www.babylonjs-playground.com/#ZENDZ2 You can throw a bullet(ball) with key E and move the mouse while holding left mouse button. Try to throw the bricks and change the color of all bricks! It dont works because you hit a some other brick physicsImpostor. Why? I want to hit each brick while they are parenting and dynamically add new objects (bricks). Edit: I want also remember to this parenting bug: Other Topic Maybe this problem depends on this.
- 1 reply
-
- collide
- physicsimpostor
-
(and 1 more)
Tagged with:
-
Hello world, this is my first post (and first weekend using babylon) so please be kind First I'd like to say that BJS is amazing, and I can't believe I've gotten this far as someone with little programming background. Here is a playground that shows the issue I'm having: http://www.babylonjs-playground.com/#DR6N9#15 The player (box) is able to throw fireballs, via spacebar. Movement is WASD. The code is supposed to detect collision of the fireball instance with the ground, dispose the fireball instance, and create a new different instance of the fireball being lodged in the ground. And then dispose that. This does happen occasionally, but only when the player is facing x or z directions. (On my localhost I dont have the direction issue?) The rest of the time the fireball keeps bouncing along. In both my localhost and the playground, the lodged fireball instance often appears mysteriously floating in the air instead of in the ground. I can't figure out if this is a physics engine issue or an issue with my code (most likely ). Any insight would be greatly appreciated. Thanks!
- 3 replies
-
- registeronphysicscollide
- dispose
-
(and 1 more)
Tagged with: