Let’s say there are two point A and B. A capsule object need to go from point A to B.
I already did the scaling part but can’t seems to get how the rotation is working.
My code part for rotation is
pointA is (p1x,p1y,p1z)
pointB is (p2x,p2y,p2z)

Brother I am doing a project where python script is sending me coordinate by socket programming and I have to put the capsule between 2 points. Rotate method need and angle x y z value. All I am asking how to calculate that. or some other method all ready exist.

@FatinFardaous first calculate a vector between points A and B, then align your object along that vector. Use existing Unity commands to do that.

Something like this would align an object between 2 points I think:

// Calculate a vector from point A to B
Vector3 vectorAB = pointB.transform.position - pointA.transform.position;
// Calculate the center point
Vector3 center = (pointA.transform.position + pointB.transform.position) / 2f;
// Set position of the object if your pivot is in the center
alignedObject.transform.position = center;
// Adjust up vector to rotate the object
alignedObject.transform.up = vectorAB;

There are many different ways to do this, I think you could use LookAt, or calculate an angle from the AB vector, and then use Quaternion.Euler to set the rotation if you just need to do a rotation on one plane. But this pseudo code I showed should work for 3D.