nomanic Posted December 30, 2015 Share Posted December 30, 2015 Hi I'm totally new to Babylon, but have to complete a projectI'd be really grateful for anyones help on here I have a sphere, made to look like the earthI have a coordinate system, that positions bars around the Earth's surface according to a lat/longnow what I do, is take the Earth as the first sphere, create a sphere on its surface where say London isThen join them by a cylinderLearnt that from a topic on hereThen make the length of the cylinder too long, so it sticks out from the earths surfaceits to represent something, so say London has 50% smog, New York 10%, Delhi 100%and you can visualise different things around the worldanyways, it now seems we need 4 bars to protrude at each locationI have one cylinder in place, I need to position 4 thinner cylinders at the end of the larger cylinderto form a kind of mini bar chart at each locationbut I'm completely stumped about how to do thisI can do one, its centered on the larger cylinder on the same axis at the same angleI want to shift each of them off center of the larger cylinderany help would be much appreciated!Many thanks(I dont know if this is hard or easy) Quote Link to comment Share on other sites More sharing options...
jerome Posted December 31, 2015 Share Posted December 31, 2015 a PG would help us to help you Quote Link to comment Share on other sites More sharing options...
nomanic Posted December 31, 2015 Author Share Posted December 31, 2015 sorry WOPR, thankyou here is PG - http://babylonjs-playground.com/#R7ZMI#1 Currently cylinder1a, cylinder2a, cylinder3a, cylinder4a are all at same point vendI'd like to move them across the end of the larger cylinderI'd like to be able to nudge them across that plane so they form a lineI don't know what arrangement I want, so I'd like to be able to control position and sizesmake sense?I'd really appreciate your helpMany thanks Quote Link to comment Share on other sites More sharing options...
jerome Posted December 31, 2015 Share Posted December 31, 2015 http://babylonjs-playground.com/#R7ZMI#2 I just simplified the PG so that we can focus on your geometry problem (and that my old laptop could run at a decent framerate)So can you tell us a bit more, because I don't understand what you try to achieve. I can see that you've got 4 red cylinders in the code and 1 transparent one.How do you want your 4 cylinders to be located and orientated ? Quote Link to comment Share on other sites More sharing options...
nomanic Posted December 31, 2015 Author Share Posted December 31, 2015 Thanks Jerome ok, so the 4 red cylinders (thats all I care about)lie on the end cap of the larger transparent cylinderall centered on its end, overlapping each otherI want to basically move them round on that end capMy original idea is to have them in a line, like a mini bar chartbut that may change, so I just need to be able to reposition them on that end capnudge them to the left or right so they form a line of columns Quote Link to comment Share on other sites More sharing options...
jerome Posted December 31, 2015 Share Posted December 31, 2015 let's redefine a little : you want the 4 red cylinders side by side, in a same plane, like panpipesand you want this line of columns based on a tangent to the big sphere ? Quote Link to comment Share on other sites More sharing options...
nomanic Posted December 31, 2015 Author Share Posted December 31, 2015 EXACTLY! Quote Link to comment Share on other sites More sharing options...
jerome Posted December 31, 2015 Share Posted December 31, 2015 http://babylonjs-playground.com/#R7ZMI#3 I just computed a cross vector Y^vend what is a tangent vector to the sphere (orthogonal to both vend and Y world axis)Then I normalized it(line 41) Then I just added this tangent vector, scaled to + or - your cylinder radius, to each red cylinder position. Is this what you wanted ? Quote Link to comment Share on other sites More sharing options...
nomanic Posted December 31, 2015 Author Share Posted December 31, 2015 It's perfect Jerome! Thankyou May I ask one quick question?If I wanted to nudge them along the other axis? (so right now they go left to right)If I wanted them to go top to bottom? (just so I know)How would I do that? Quote Link to comment Share on other sites More sharing options...
jerome Posted December 31, 2015 Share Posted December 31, 2015 for the other way (right to left), just change the values in the scale factor (-0.4, -0.2, etc)for top to bottom, I guess you could change the y value of the pivot matrix from -dis/2 ot +dis/2 http://babylonjs-playground.com/#R7ZMI#4 Quote Link to comment Share on other sites More sharing options...
nomanic Posted December 31, 2015 Author Share Posted December 31, 2015 Thanks Jeromebut thats not what I meantby top to bottom, I just mean right now they go "across" the tangent to the EarthLike in Equal Latitude, I mean lined up in equal LongitudeNot "into" the Earth, but ALWAYS sticking outmake sense? Quote Link to comment Share on other sites More sharing options...
nomanic Posted January 2, 2016 Author Share Posted January 2, 2016 Hi guys (Jerome?) It's been changed now, I have to make the below? Any help?I really appreciate all your help so far Jerome Thanks Quote Link to comment Share on other sites More sharing options...
jerome Posted January 3, 2016 Share Posted January 3, 2016 http://babylonjs-playground.com/#R7ZMI#5 just computed another tangent vector tan2, orthogonal to the first tangent tan and to the radius vendSo I have now 3 orthogonal axis at the surface of the sphere : vend, tan, tan2.I just have to position the cylinders where I want in the plane (tan, tan2) Quote Link to comment Share on other sites More sharing options...
nomanic Posted January 6, 2016 Author Share Posted January 6, 2016 Hi Jerome I just implemented what you did here-http://babylonjs-playground.com/#R7ZMI#6 and it works perfectlybut when I put it into the real site here-http://www.nomanic.biz/babylon/ They are not perfect squaresany ideas? Thanks Quote Link to comment Share on other sites More sharing options...
jerome Posted January 7, 2016 Share Posted January 7, 2016 http://babylonjs-playground.com/#R7ZMI#7 I just visualized the (tan, tan2) vectors on the point vend so you can understand how the squares were quickly set in this example.You can of course set them differently according to your needs.Just consider (tan, vend, tan2) as you would consider (X, O, Z) on the plane xOz Quote Link to comment Share on other sites More sharing options...
jerome Posted January 7, 2016 Share Posted January 7, 2016 I recoded everything cleaner and I got rid off all the quaternion stuffI used instead the magic function RotationFromAxis() code commented here : http://babylonjs-playground.com/#R7ZMI#11 many cities on earth : http://babylonjs-playground.com/#R7ZMI#10 JohnK, iiceman, Temechon and 1 other 4 Quote Link to comment Share on other sites More sharing options...
MarianG Posted January 7, 2016 Share Posted January 7, 2016 Jerome, your "math" is amasing jerome 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 8, 2016 Share Posted January 8, 2016 Definitely impressive:) Quote Link to comment Share on other sites More sharing options...
jerome Posted January 8, 2016 Share Posted January 8, 2016 meuh non 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.