Example:

MobilityHelper mobility;
Ptr<ListPositionAllocator> positionAlloc = CreateObject <ListPositionAllocator>();
positionAlloc ->Add(Vector(0, 0, 0)); // node0
positionAlloc ->Add(Vector(1000, 0, 0)); // node1
positionAlloc ->Add(Vector(450, 0, 0)); // node2
mobility.SetPositionAllocator(positionAlloc);
mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
mobility.Install(nodes);

References

[1] Google Groups. ns3. Assign Positions to Mesh Nodes. https://groups.google.com/g/ns-3-users/c/8e7fIZTMV_A?pli=1

--

--