jerome Posted January 8, 2015 Share Posted January 8, 2015 Hey folks, As I needed curves, I ran into some maths (thx wikipedia as my university years are far ago now) and, especially for you tonight, ladies and gentlemen, tandam !!!, here are quadratic and cubic Bézier curves : http://www.babylonjs-playground.com/#1023O (if you don't want to read the code, jump right to line 100 for function calls)quadraticBezier(vector3Origin, vector3Control, vector3Destination, segmentNumber) returns an array of segmentNumber Vector3 along a quadratic Bézier curve (amazing, isn't it ?) from the origin vector to the destination vector, curved by the control vector.cubicBezier(vector3Origin, vector3Control1, vector3Control2, vector3Destination, segmentNumber) does the same, but you give 2 control points here instead of only one. Then you can easily use these arrays for drawing meshes or simple lines as I did with createLines, though I don't think it's the best way to do. Hope it helps. GameMonetize, Dad72 and Wingnut 3 Quote Link to comment Share on other sites More sharing options...
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.