End points of a thin cylinder between two Entities

Blitz3D Forums/Blitz3D Programming/End points of a thin cylinder between two Entities

Eric(Posted 2011) [#1]
I would like to create two Spheres with a cylinder's end points between them.. No matter where the spheres are the Cylinder's end points with align to the centers of the spheres.

What is a good method for this?

Thanks,
Eric


Yasha(Posted 2011) [#2]
1) Create a cylinder.

2) Use ScaleMesh (not ScaleEntity) to shorten the cylinder to half its length.

3) Use PositionMesh to move the cylinder's mesh data so that the centre point of the mesh is now in the centre of one of the end discs (although actually you may as well have an open-ended cylinder since the ends will be obscured).

4) Position the cylinder on top of one of the spheres.

5) Point the cylinder at the other sphere.

6) Use ScaleEntity (not ScaleMesh) to adjust the diameter to fit the spheres and the length to reach all the way to the second sphere. Because of step 1, the scale factor for the length should simply be the distance between the two spheres.


Eric(Posted 2011) [#3]
Cool... I do not totally understanding... Do you have a code snip to share?

Thanks,
Eric

Last edited 2011


Midimaster(Posted 2011) [#4]
this problem was a theme in the german forum last week:

solution:

http://www.blitzforum.de/forum/viewtopic.php?t=393357

whole Thread:

http://www.blitzforum.de/forum/viewtopic.php?t=37608

perhaps it may help you...