JZ7878 Posted November 21, 2018 Share Posted November 21, 2018 Hi All, I want to create something like: Currently, What I get is: How can I create shaps that can control only showing part of edges, thanks in advance! Quote Link to comment Share on other sites More sharing options...
JohnK Posted November 21, 2018 Share Posted November 21, 2018 With meshes you could do it this way https://www.babylonjs-playground.com/#W8L8IP using https://doc.babylonjs.com/snippets/line2d and note that because CreatePolygon uses earcut for your own project you will need a copy from github. If you are just working in 2D then a sprite may suffice. Sebavan 1 Quote Link to comment Share on other sites More sharing options...
JZ7878 Posted November 22, 2018 Author Share Posted November 22, 2018 @JohnK OK, I will try it first, it seems a way for me to make it, thank you very much! Quote Link to comment Share on other sites More sharing options...
JZ7878 Posted November 22, 2018 Author Share Posted November 22, 2018 @JohnK I changed some configuration of your demo, and saved as https://www.babylonjs-playground.com/#W8L8IP#1 , actrually I just need a 2D(XoZ) product, but I found that in that way, if I commented the rotating operation and changed the width of the line, it will flash very quicky while I move/zoom the scene, and the line is not so clear. I did not understand the way you mentioned for 2D, could you explain more on how to use sprite to do that? Quote Link to comment Share on other sites More sharing options...
JohnK Posted November 22, 2018 Share Posted November 22, 2018 The flashing is because of z-fighting with the textures. You prevent this by separating the meshes (line 210). Having stopped the rotation the direction of separation has to change from z to y https://www.babylonjs-playground.com/#W8L8IP#2 As you want the shape too be in XoZ plane and to rotate, then sprites will not work as they always face the camera. You can achieve the same idea with a transparent image on the ground plane ( the image used would need improving but shows the idea) https://www.babylonjs-playground.com/#8UZ3JD Sebavan and JZ7878 2 Quote Link to comment Share on other sites More sharing options...
JZ7878 Posted November 23, 2018 Author Share Posted November 23, 2018 @JohnK OK, thanks a lot! It works for my current requirement. Sebavan 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.