Search the Community
Showing results for tags 'impostor'.
-
Hi, I am trying to load the Dude.babylon, set its position and enable physic engine in order to he collides with the ground. It is almost working : https://www.babylonjs-playground.com/index.html#YYQ1LC#35 I tried different way of loading and it change nothing. I have some problems : As soon as I add the physicImpostor, I have an error message in the console, even if the dude is loaded and displayed : BJS - [18:05:26]: Unable to import meshes from Scenes/Dude/Dude.babylon: Error in onSuccess callback As soon as I add the physicImpostor, positionning start to bug (every character are in the same place) Finaly, I have to use MeshImpostor and I would like to simplify collision with a box, but replacing MeshImpostor by BoxImpostor doesn't work, why ? How to not use MeshImpostor ? (I tryed to create parent mesh but without success) Thanks
-
Hi All, Disclaimer: I'm very new to Babylon. I was playing around with this cloth tutorial, and I wanted to make the cloth land on some sort of ground object. So far, I haven't been able to find one that works. You can see in this playground how the cloth reacts to a box impostor, side-by-side with a sphere behaving normally. I have the restitution of everything set to 0. The sphere stops nicely but the cloth shoots off into the distance. I've also tried this with a ground impostor (sphere works fine, cloth doesn't interact with the ground), and a plane impostor (cloth collides correctly, but sphere shoots up into the stratosphere). I have also tried adjusting the initial linear velocity of the cloth particles. More velocity = flies away faster, less velocity = falls right through the ground. My ultimate goal involves the cloth having an initial z velocity, so I'd like to be able to make that work. Can someone help me figure out what I'm missing here? Does it have something to do with the distance joints connecting the particles in the cloth? Should I try using sphere impostors instead of particles? Thanks! (side note: is there a better way to translate the cloth's position than the translatePositions function I made? The built-in ground.rotation.axis method rotates the cloth, but not the actual particles themselves)
-
if we set box1.physicsImpostor do we still have to set box1.checkCollisions = true; or can we remove box1.checkCollisions = true; from code? why we need .checkCollisions = true? Is not box1.physicsImpostor enought to do in code? Why/When we must do .checkCollisions = true for colliders? How .checkCollisions = true actualy works in babylonjs engine ? greetings Ian
- 6 replies
-
- impostor
- checkcollision
-
(and 4 more)
Tagged with:
-
Is is there any way to debug impostor of mesh. If we have BABYLON.PhysicsImpostor.BoxImpostor on some mesh, Can we debug bouning box of BoxImpostor or any other impostors, that we can see how Impostors looks like around mesh? greetings ian
- 11 replies
-
- debug bounding coliider
- collider
-
(and 2 more)
Tagged with:
-
I have always used "setPhysicState" to set physics properties of objects, in many projects. Meanwhile I read it's better to use "new BABYLON.PhysicsImpostor" instead. Why should that be better? What are advantage and disadvantage?
-
I have recently started on a Babylon project, and I have been wanting to create a capsule physics impostor for my game. I found a test demo for Oimo.js that basically achieves what I want: compound test (capsule). There are two problems: 1. due to some shortcomings in Oimo, I have had to switch to Cannon.js. 2. the demo uses Three.js and I'm sure how to exactly translate that into Babylon. I basically want to be able to combine two sphere impostors with a cylinder impostor. I'm not sure what is the best method for this, there are only a few examples that I have found, and I haven't found anything in the docs. So I created an example to show what I am talking about: capsule sandbox. I have created the capsule mesh, but I just need to figure out how to add a capsule impostor. Thanks.
-
Why ? var rawVerts = object.getVerticesData ? object.getVerticesData(BABYLON.VertexBuffer.PositionKind) : []; var rawFaces = object.getIndices ? object.getIndices() : []; BABYLON.Tools.Warn("MeshImpostor only collides against spheres."); returnValue = new CANNON.Trimesh(rawVerts, rawFaces); Even tho CannonJS supports mesh/plane collision ? : Demo : https://schteppe.github.io/cannon.js/demos/bunny.html Source : https://github.com/schteppe/cannon.js/blob/master/demos/bunny.html // ground plane var groundShape = new CANNON.Plane(); var groundBody = new CANNON.Body({ mass: 0, position: new CANNON.Vec3(0,0,-5) }); groundBody.addShape(groundShape); world.addBody(groundBody); demo.addVisual(groundBody); Edit: Ok, I overlooked the fact that the Mesh impostor is infact a Trimesh shape (https://schteppe.github.io/cannon.js/demos/trimesh.html). So can you add ConvexPolyhedron shapes in the next release please ?
-
Hi there, I'm stuck and I can't seem to find a workaround for achieving this, basically what I wanna do is set the Camera as a parent for a small Platform which has a Box impostor of Mass 0, and make a crate which also has physics (Mass 1) land on it. But the problem is that the platform acts as if it has no physics at all, instead of landing on it, the crate goes through , here is the PG : http://www.babylonjs-playground.com/#18UP4N Any help would be really appreciated. Thanks.
-
Hello guys, at first: Wow, what a helpful community, I have learned a lot by reading here and using your samples on the playground - thanks! Now, here is my problem: I want to show the oscillations of a stacker crane with the cannon-plugin, because I need the spring-constraints to simulate the stiffness of the crane. Because there is no slider-constraint, I am using a workaround with the createCompoundImpostor to "bind" the load handling device to the crane. But I don't really know how to use this function correctly. I've only found one example, which works, yes, but the declaration of the function is another... (vsCode with typescript tells me: Supplied Parameters do not match ...). In addition, the createCompoundImpostor is deprecated, but what is the alternative? I can't get the impostor.parent to work. I made a simple playground example for you: http://www.babylonjs-playground.com/#1Z17G7#12 You can click on the green box to move the crane and click on the crane to move down the load handling device. Because there is no slider-constraint, I have to move the geometric objects down and then add all the joints again, because I'm calling impostor.forceupdate(). If it's important: I'm using imported 3D-Models from Blender in my current version, but for physics I'm using the boximpostors with visibility = 0. Actually my question is: How to use the createCompoundImpostor correctly or better what is the alternative? Thank you!
-
I have problem with physics and mesh impostor with sphere. I create some componets in blender. And add each component texture. I create pathMesh from components. (pathMesh have multi materials and textures because each component has its own material and texture) If I load babylon with sandbox it load OK (but sandbox doesn't have pathMesh.bakeCurrentTransformIntoVertices(); . If I have pathMesh.bakeCurrentTransformIntoVertices(); in loop then pathMesh is loaded without textures and physics works OK. If I remove pathMesh.bakeCurrentTransformIntoVertices(); then pathMesh is loaded correctly with textures, but physics doesn't work as it should. var pathMesh; meshTask.onSuccess = function (task) { for (var i=0; i<task.loadedMeshes.length; i++ ){ var newMesheI = task.loadedMeshes[i]; if ( newMesheI.id == "Path" ) { pathMesh = newMesheI; pathMesh.checkCollisions = true; pathMesh.bakeCurrentTransformIntoVertices(); // this line works ok with physics but pathMesh doesn load correcly with textures pathMesh.pBody= perplexus.setPhysicsState(BABYLON.PhysicsEngine.MeshImpostor , { mass: 0, friction: 0.4, restitution: 0 }); } ... I need pathMesh.bakeCurrentTransformIntoVertices(); and correcly inported pathMesh with its textures? Can anybody help me solve this problem? Any advice? What should I do? Am I missing anything? Greetings