Angles/Distance problem

Lets say i got Tranform A and B

Transform A is a rigid Body Kinematic to a moving Object.

i want Transform B to always be away 1 unit from A, object B rotates

so what i could do was something like

b.rotation = a.rotation;
b.position = Vector3.MoveTowards (b.position , a.position, smoothTime)

but on the line above B would take A position not A-1

any work around?

if not what i might have to do is duplicate transform B make A its parent and make it 1 unit away, then just make B follow this new duplicate

so lets call this duplicate C

id just need to make

b.position = a.position ;
b.rotation = a.rotation ;

this last way works but its not as neat as id want

i also just put some more thought into it and i was wondering if this should be a good idea

Lets make more apropriate names where A is toFollow and B is Path toLead

var toFollow : Transform;
var toLead : Transform;
var Distance : 1.0;

// this is a  2d game so i only use z on rotation and y.x on position

var toLeadRotationAngle = tolead.eulerAngles.z;
var toFollowRotationAngle = toFollow.eulerAngles.z;

//now i got 2 variables with angles locked in z

toFollowRotationAngle = Mathf.LerpAngle (toFollowRotationAngle, toLeadRotationAngle, smooth);

// Convert the angle into a rotation

var newToFollowRotation = Quaternion.Euler (0, 0 , toFollowRotationAngle);

toFollow.position = toLead.position ;
toFollow.position -= newToFollowRotation * Vector3.forward * distance;

Just edite the code there were some errors i didnt notice with coding :stuck_out_tongue:

Solved get Ragdoll strenght up and added hinge joint and 0.1 limit looks perfect