Ice-T Posted November 28, 2016 Share Posted November 28, 2016 Hello, I'm realy new to this and i want to apologize in advance if this question already had been handled a couple of times, but i could not find a solution after 2 days. So i'll give it a try and ask you guys What i want: I do expect Points (x,y,z) which build a closed custom shape. The shape may consist of n-Points (in my Example there are 5). The shape also has to be extruded by a specific length. Everything will be extruded into the Z-Axis. Next step is creating a material and applying it to the Mesh. The Problem: Because of the CAP_ALL parameter my texture is not aligned properly (see related question: related post). I can't use the MeshBuilder.CreateBox because my shapes are not always boxes and i could not find any way to fix my Mesh's uvs You can see my example here: http://www.babylonjs-playground.com/#ULTEI#3 My Solution: I create a box and subtract each face. This is the only possible solution i found. (Yet it's not acceptable) You can see the shame here: http://www.babylonjs-playground.com/#ULTEI#4 Can anyone point me in the right direction how to manage this? Any help would be appreciated. Thank you all in advance Quote Link to comment Share on other sites More sharing options...
Ice-T Posted November 29, 2016 Author Share Posted November 29, 2016 Edit: 29-11.2016 After another frustating day, I tried a new way and the textures applied correctly: http://www.babylonjs-playground.com/#2GIE3Z#0 what do i do? : I create a Mesh with ribbons for the front, another one for the outside and a last one for the backside. After everything is done, i merge them to one mesh. (Earlier i mentioned: Quote The shape may consist of n-Points Well, i guess i need to think of a logic for this one. For the first step, 4-5 points is enough for now ) New Problem: If i want to cut a hole in my Mesh, the Subtraction does not subtract as i expected. Anyone having an idea why? I guess I am missing some basic understandings? I do welcome any hints and help. Thank you. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 29, 2016 Share Posted November 29, 2016 Are you using CSG for the boolean operation? Quote Link to comment Share on other sites More sharing options...
Ice-T Posted November 30, 2016 Author Share Posted November 30, 2016 Yes, I am using the BABYLON.CSG. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 30, 2016 Share Posted November 30, 2016 can you reproduce the issue in the playground? Quote Link to comment Share on other sites More sharing options...
Ice-T Posted December 1, 2016 Author Share Posted December 1, 2016 Quote The Problem: Because of the CAP_ALL parameter my texture is not aligned properly (see related question: related post). I can't use the MeshBuilder.CreateBox because my shapes are not always boxes and i could not find any way to fix my Mesh's uvs You can see my example here: http://www.babylonjs-playground.com/#ULTEI#3 Quote My Solution: I create a box and subtract each face. This is the only possible solution i found. (Yet it's not acceptable) You can see the shame here: http://www.babylonjs-playground.com/#ULTEI#4 And here the post with the CSG subtract problem: Quote After another frustating day, I tried a new way and the textures applied correctly: http://www.babylonjs-playground.com/#2GIE3Z#0 Quote Link to comment Share on other sites More sharing options...
Ice-T Posted December 1, 2016 Author Share Posted December 1, 2016 Edit: 01-12-2016: I may present, my new approach, which is actually working (for me and my simple-minded goals): http://www.babylonjs-playground.com/#1GXCNM#1 (^^^^^^EXAMPLE^^^^^^) After experimenting with a lot of stuff I came up with a new "best" method again to achieve my goals. (n-point custom 3D shape, see example) What's the idea?: 1. Calulate the boundaries of my shape ( i guess there is a BJS tool which could help me, but i did not found anything in this short time. Maybe the collision boundaries?) 2. Creating a Box with the boundaries and placing it exactly on the position my "CustomMesh" shall be 3. Creating my CustomMesh with ExtrudeCustomShape 4. Having a Box and a Shape, i cut out the shape from the box, use this new "form" and cut out the box again. (see the code in the example for more details.. "var create3DObject....") 5. setting a mesh object on position 0,0,0 as parent, because my CustomMesh "descended" from a box. (i want to translate and rotate later... Not in my example above) Exception: All points for the shape have to come in counterclockwise, else the shape will not be cut out correctly. Anybody knows how to get it working for both clock-directions? Remembering: I did this all because i had no clue about how to coorrectly set the UVs and the material on a Mesh, generated from "ExtrudeCustomShape". The CAP_ALL parameter created the faces i wanted, but not the correct UVs . I have the feeling i do "misuse" BJS because the lack of knowledge/experience for such simple goals. But this is all i can do for now to get things working. I do REALY hope somebody may tell me how to do this properly. I welcome any help and directions! Thank you so far. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted December 1, 2016 Share Posted December 1, 2016 ok cool 1. you can get it with mesh.getBoundingInfo().boundingBox Ice-T 1 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.