shakeel ahmed Posted November 15, 2016 Share Posted November 15, 2016 Hello guys, I have made two custom meshes properly using xhtml code, one is garment(T-Shirt) and another is Model(Human Body).But i am trying to simulate Garment with Model means i have added physics engine and collision. I am unable to add imposter and joints. Beacuse of this, the simulation task between Garment(Cloth) and Model(Human Body) is done .I am too much stuck and waiting your reply. I am writing whole code for both custom meshed Code: var position_vertices_data = garment.getVerticesData(BABYLON.VertexBuffer.PositionKind); var spheres = []; for (var i = 0; i < position_vertices_data.length; i = i + 3) { var v = BABYLON.Vector3.FromArray(position_vertices_data, i); var s = BABYLON.MeshBuilder.CreateSphere("s" + i, { diameter: 0.5 }, scene); s.position.copyFrom(v); s.position.y = 60; spheres.push(s); } function createJoint(imp1, imp2) { var joint = new BABYLON.DistanceJoint({ maxDistance: 1 }) imp1.addJoint(imp2, joint); } spheres.forEach(function (point, idx) { var mass = 1; point.physicsImpostor = new BABYLON.PhysicsImpostor(point, BABYLON.PhysicsImpostor.ParticleImpostor, { mass: mass, restitution: 0.9 }, scene); if (idx >= subdivisions) { createJoint(point.physicsImpostor, spheres[idx - subdivisions].physicsImpostor); if (idx % subdivisions) { createJoint(point.physicsImpostor, spheres[idx - 1].physicsImpostor); } } }); Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 15, 2016 Share Posted November 15, 2016 Hello could you reproduce it in the playground? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.