WhoAteDaCake Posted July 17, 2017 Share Posted July 17, 2017 function addSphere(scene, { x, y, z }: Object, diameter: number = 0.05, color = new BABYLON.Color3(0, 0, 0)) { const sphere = BABYLON.MeshBuilder.CreateSphere("sphere", { diameter }, scene); const material = new BABYLON.StandardMaterial("texture1", scene); material.diffuseColor = color; sphere.position = new BABYLON.Vector3(x, y, z); sphere.material = material; } const positions = mesh.getVerticesData(BABYLON.VertexBuffer.PositionKind); const zeroCoord = { x: positions[0], y: positions[1], z: positions[2], }; addSphere(scene, zeroCoord, 1); Demo As you can see in the code, I am just trying to get vertices of the foot. and the placing a sphere on the first vertice of the foot. But for some reason, as can be seen in demo, the sphere is added somewhere not even remotely close of the foot. You can download the mesh here. Why is this happening ? I've been trying to fix this for two days now, but I can't seem to do it. Edit: I am using babylonjs exported for blender. Edit2: Added playground url https://www.babylonjs-playground.com/#EEKFSK#2 Quote Link to comment Share on other sites More sharing options...
Samuel Girardin Posted July 17, 2017 Share Posted July 17, 2017 Hi, In fact, your mesh is exported from your 3d software with a scale, rotation, and translation. The vertex buffer come from your original mesh. Maybe you can try something like resetXfrom(in max), don't know the equivalent in blender. Hope this helps. "meshes":[{"name":"Sym_trie Sock sock","id":"Sym_trie Sock sock","materialId":"feet.Female_Mesh","billboardMode":0, "position":[-1.4393,-0.0012,-0.0036], "rotation":[-1.5708,0,0], "scaling":[0.069,0.069,0.069],"isVisible":true,"freezeWorldMatrix":false,"isEnabled":true,"checkCollisions":false,"receiveShadows":false ,"positions":[38.3717,-10.4411,0.0043, Quote Link to comment Share on other sites More sharing options...
WhoAteDaCake Posted July 17, 2017 Author Share Posted July 17, 2017 @Samuel Girardin THANK YOU SO MUCH!!!! Turns out I had to follow this tutorial. I just needed to apply the changes using Object apply. I am new to blender, so I didn't really know this.... 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.