Placing an object in front of another object using transform.forward causes the position to flicker

I had a question earlier concerning this problem, and I figured out that it was not the rigidbody that had been causing the flickering position, but that by using objectA.transform.forward (I’m calling the object behind the other object objectA, and the object in front of the other object objectB) in the script of objectB was causing the position of objectB to flicker. Using objectA.transform.position had no flicker when I looked at it in the scene view.

Here is the script in objectB that I am using

void Update () {
	transform.position = attachedObject.transform.position + Vector3.up * 2;
	//rb.MovePosition(attachedObject.transform.position + attachedObject.transform.forward + attachedObject.transform.right/3 - new Vector3(0f, .35f, 0f));
	//rb.MovePosition(Vector3.MoveTowards(rb.position, attachedObject.transform.position + attachedObject.transform.forward/1.75f + attachedObject.transform.right/3 - new Vector3(0f, .35f, 0f), Time.deltaTime * 5));
	//print (attachedObject.transform.position + attachedObject.transform.forward/1.75f + attachedObject.transform.right/3 - new Vector3(0f, .35f, 0f));

Is there a smarter way of placing an object in front of another object, and why does transform.forward give inconsistent results?

If you have rigidbody attached to any of them then set interpolate to interpolate or extrapolate, And if none of them is working then use Vector3.Lerp to put object2 to the forward of object1. If you didn’t get the result then please explain a little :slight_smile:
Hope this will help :slight_smile: