Given 2 points in 3D (a,b) and an SCNCapsule, SCNTorus, SCNTube etc., how to go about to position the object, so that the object starts at poin
There is no easy way to do it, but it should not be that hard either. You should implement an algorithm that go through the following steps:
SCNVector3
d
is the previously found distance).
SCNCapsule
and SCNTube
, set height
to the distance SCNTorus
, set ringRadius
to d/2-pipeRadius
SCNBox
, set any side to d
Once you do that, the shape you created should meet the points at both ends. You can check this is correct using a bounding box, making sure the right axis is equal to the distance.
I have no code sample, but give it a try and if it doesn't work I can debug it for you.