But its not my answer. My problem is; I want to remove rotation affect which is provided by parent. So any other object or function can change transforms rotation.
Edit: (My Scenerio) :
In my game I used camera path and camera moves on a path while moving an object(vehicle) must follow the camera but only positional followign i dont want to rotate vehicle with camera.
Instead of parenting the camera try to create a script that moving them just as the camera moves.
public class CameraFollow : MonoBehaviour
{
public Camera camera //assign the camera in inspector or in Start()
private Vector3 prevPos;
void Start()
{
prevPos = camera.transform.position;
}
void Update()
{
Vector3 displacement = camera.transform.position - prevPos;
prevPos = camera.transform.position;
this.transform.positon += displacement;
}
}
and put this script on the object you would like to keep the distance from camera