distraub Posted July 28, 2017 Share Posted July 28, 2017 Hey guys, I have been trying to do this for awhile, and feel like I am almost there. I had been using Bezier Curves but it wasn't quite doing what I needed. I need to draw an arc made with lines between 2 points on the sphere, following the curve of the sphere. I think I am close on this playground but some of my math isn't right in the drawArcFromPoints function Anyone think they can take a look and tell me where I am going wrong? https://www.babylonjs-playground.com/#2I0VXX#28 Quote Link to comment Share on other sites More sharing options...
distraub Posted July 31, 2017 Author Share Posted July 31, 2017 And I finally figured it out. https://www.babylonjs-playground.com/#2I0VXX#34 Quote Link to comment Share on other sites More sharing options...
distraub Posted July 31, 2017 Author Share Posted July 31, 2017 Well thought I figured it out but it doesn't exactly work for all points, sort of spirals on some. https://www.babylonjs-playground.com/#2I0VXX#39 GameMonetize and Arte 2 Quote Link to comment Share on other sites More sharing options...
d13 Posted December 8, 2017 Share Posted December 8, 2017 @distraubThis is awesome!! The `projectLatLongToSphere` function was exactly what I needed for my current project. distraub and Gijs 2 Quote Link to comment Share on other sites More sharing options...
jerome Posted December 9, 2017 Share Posted December 9, 2017 the function showAngleSectors() here https://github.com/jbousquie/UserFunctions/blob/master/showAngleSector.js does exactly what you need origin is the center of the sphere, vector1 your first point, vector2 your second point and radius the sphere radius https://www.babylonjs-playground.com/#FUK3S#7 Arte, adam and distraub 3 Quote Link to comment Share on other sites More sharing options...
distraub Posted June 7, 2018 Author Share Posted June 7, 2018 Wow Jerome Sorry I didn't realize you came back and replied, you are awesome GameMonetize and jerome 1 1 Quote Link to comment Share on other sites More sharing options...
olsibob Posted August 15, 2018 Share Posted August 15, 2018 Apologies for bumping an old topic, here's my effort. It uses TransformNode.LookAt to create rotationQuaternions, and then Quaternion.Slerp to interpolate the line points: https://www.babylonjs-playground.com/ts.html#QIX6TN#11 Tap on the sphere to add more lines. The lines are fairly good, though can get a bit curvy depending on where on the sphere you tap if one of the points is at the north pole (I guess because of this being the up axis of the look-at function? I wonder whether I could supply an alternate up axis in those cases). On the plus side, there's no custom maths, it just uses BabylonJS methods. On the minus, I'm not sure I like adding/removing temporary TransformNodes to the scene just to jump on their LookAt methods (I tried using the Matrix.LookAt methods, but the results weren't good). jerome 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.