Numa Posted June 28, 2016 Share Posted June 28, 2016 Hi there, is there a way to dynamically update a Lines2D's points array? I'm trying to have a line drawn between 2 meshes and I want it to stretch if needed when the camera rotates etc so it needs to be updated every frame. This doesn't seem to work: var pts = new Array(mesh1, mesh2); myLine.points = pts; The variable is updated but the line isn't redrawn. Is there a flag to trigger a render? Thanks Quote Link to comment Share on other sites More sharing options...
Nockawa Posted June 28, 2016 Share Posted June 28, 2016 11 hours ago, Numa said: Hi there, is there a way to dynamically update a Lines2D's points array? I'm trying to have a line drawn between 2 meshes and I want it to stretch if needed when the camera rotates etc so it needs to be updated every frame. This doesn't seem to work: var pts = new Array(mesh1, mesh2); myLine.points = pts; The variable is updated but the line isn't redrawn. Is there a flag to trigger a render? Thanks Hello, nope, every settings are currently immutable (you set them at construction and can't change them), but it's on my todo list and should be done quickly (especially if you need it). I'm on a short holidays right now away from home, but thursday I'll be back. I'll see what's possible, if I can do it quickly, I keep you in touch. Numa 1 Quote Link to comment Share on other sites More sharing options...
chicagobob123 Posted June 28, 2016 Share Posted June 28, 2016 Please let me know when this is done. If you could include the ribbon as well. I need to leave/show a trail of movement for a vehicle for a fixed period of time. Say you are driving and you can see your all your movements for the last 3 minutes. Quote Link to comment Share on other sites More sharing options...
Numa Posted June 28, 2016 Author Share Posted June 28, 2016 No worries, thank you enjoy your holiday Quote Link to comment Share on other sites More sharing options...
Gil Posted April 27, 2017 Share Posted April 27, 2017 Hello @chicagobob123 Is it still something to you plan to add ? The only solution I found is to dispose and recreate the line at each if I want to update it. Is there another way ? Quote Link to comment Share on other sites More sharing options...
chicagobob123 Posted April 27, 2017 Share Posted April 27, 2017 I put something into the code to make a line have not been back to that code base for some time. Here I found it. Let me pseudo code it. Every time my position changes or some set interval. If I have no points saved (aka no path) add the point to TracePath Else If I have one point in TracePath add the point to TracePath then TraceRibbon=BABYLON.Mesh.CreateTube("TraceLine",TracePath,1.0,12,null,0,scene,true, BABYLON.Mesh.BILLBOARDMODE_ALL); var mat = new BABYLON.StandardMaterial("TraceRibbonMat", scene); mat.alpha = 1.0; mat.diffuseColor = new BABYLON.Color3(0.0, 0.0, 1.0); mat.backFaceCulling=false; TraceRibbon.material=mat; Else If I have more than 2 points in TracePath add new point to TracePath then TraceRibbon=BABYLON.Mesh.CreateTube(null,TracePath,1.0,null,null,null,null,null,null,TraceRibbon); To KILL it all I make sure the length is > 1 if(TracePath.length>1) TraceRibbon.dispose(); TracePath=[]; 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.