Jump to content

Positioning Cylinders


Recommended Posts



I'm totally new to Babylon, but have to complete a project

I'd be really grateful for anyones help on here


I have a sphere, made to look like the earth

I have a coordinate system, that positions bars around the Earth's surface according to a lat/long

now what I do, is take the Earth as the first sphere, create a sphere on its surface where say London is

Then join them by a cylinder

Learnt that from a topic on here

Then make the length of the cylinder too long, so it sticks out from the earths surface

its to represent something, so say London has 50% smog, New York 10%, Delhi 100%

and you can visualise different things around the world

anyways, it now seems we need 4 bars to protrude at each location

I have one cylinder in place, I need to position 4 thinner cylinders at the end of the larger cylinder

to form a kind of mini bar chart at each location

but I'm completely stumped about how to do this

I can do one, its centered on the larger cylinder on the same axis at the same angle

I want to shift each of them off center of the larger cylinder

any help would be much appreciated!

Many thanks

(I dont know if this is hard or easy)

Link to comment
Share on other sites

sorry WOPR, thankyou


here is PG - http://babylonjs-playground.com/#R7ZMI#1


Currently cylinder1a, cylinder2a, cylinder3a, cylinder4a are all at same point vend

I'd like to move them across the end of the larger cylinder

I'd like to be able to nudge them across that plane so they form a line

I don't know what arrangement I want, so I'd like to be able to control position and sizes

make sense?

I'd really appreciate your help

Many thanks

Link to comment
Share on other sites



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 ?

Link to comment
Share on other sites

Thanks Jerome


ok, so the 4 red cylinders (thats all I care about)

lie on the end cap of the larger transparent cylinder

all centered on its end, overlapping each other

I want to basically move them round on that end cap

My original idea is to have them in a line, like a mini bar chart

but that may change, so I just need to be able to reposition them on that end cap

nudge them to the left or right so they form a line of columns

Link to comment
Share on other sites



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 ?

Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...