JohnK Posted April 24, 2015 Share Posted April 24, 2015 Having created three Bezier curves Attempt 1var curve_0 = BABYLON.Curve3.CreateCubicBezier(start_0, control1_0, control2,_0 destination_0, nb_of_points);var curve_1 = BABYLON.Curve3.CreateCubicBezier(start_1, control1_1, control2,_1 destination_1, nb_of_points);var curve_2 = BABYLON.Curve3.CreateCubicBezier(start_2, control1_2, control2,_2 destination_2, nb_of_points);I then formed a new curve by joining them together using.var myFullCurve = curve_0.continue(curve_1).continue(curve_2);However as start_1 and start_2 where not the origin (0,0,0) myFullCurve had kinks in it. By ensuring that curve_1 and curve_2 started at (0,0,0) using Attempt 2var curve_0 = BABYLON.Curve3.CreateCubicBezier(start_0, control1_0, control2,_0 destination_0, nb_of_points);var curve_1 = BABYLON.Curve3.CreateCubicBezier(start_1.subtract(start_1), control1_1.subtract(start_1), control2_1.subtract(start_1), destination_1.subtract(start_1), nb_of_points);var curve_2 = BABYLON.Curve3.CreateCubicBezier(start_2.subtract(start_2), control1_2.subtract(start_2), control2_2.subtract(start_2), destination_2.subtract(start_2), nb_of_points);I obtained a continuous curve. I read in this topic that there was a suggestion by Jerome to .... imagine you've got many curves with different origins and you want to "stick" them together one after the other without knowing/handling each curve origin and end. and gathered from the date (16 Mar 2015) curve3 and continue are recent additions. Now using subtract.start to create the curve does not require you to know start but you do have to handle it. Have I misunderstood something or applied continue incorrectly or was it the intention that something like Attempt 1 should have formed a continuous curve and does not as yet do so? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 24, 2015 Share Posted April 24, 2015 This one is for Jerome Quote Link to comment Share on other sites More sharing options...
jerome Posted April 25, 2015 Share Posted April 25, 2015 You are right : I just focused on the last hypothetical unknown point position and my PG were all with curves starting at (0, 0, 0).The continue() method should work the same way with any curve starting point.. and it doesn't. I will do a quick fix so the continue() method will work the way you expect, which is the expected way according to what I wrote in the doc. Your workaround is, well, just what I forgot to implement : an initial subtract down to the origin. GameMonetize and JohnK 2 Quote Link to comment Share on other sites More sharing options...
jerome Posted April 27, 2015 Share Posted April 27, 2015 Since I can't compile for now, could someone please change this line : https://github.com/BabylonJS/Babylon.js/blob/master/Babylon/Math/babylon.math.ts#L3431 in the math.ts file to this line instead : continuedPoints.push(curvePoints[i].subtract(curvePoints[0]).add(lastPoint));then compile and, if ok, push it into the BJS repo.It should fix the Curve3 continue() method so it will work as expected whatever the starting points in space of the concatened curves. Quote Link to comment Share on other sites More sharing options...
jerome Posted April 28, 2015 Share Posted April 28, 2015 PR submitted. Wingnut 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.