While the motion planning algorithms consider the obstacles that were known in the map, it is possible to use obstacle avoidance algorithms to take over and send commands to theunmanned aerial vehicle (UAV), when there is an unknown obstacle on the way. The rapidly random tree (RRT) algorithm is used to plan paths for a quad-copter or a fixed-wing UAV. This work develops a model for UAV with fixed-wing using a 3D map exploring the RRT technique. The first step is to obtain a 3D occupancy map from the map data stored in the UAV city to provide a map with some pre-generated obstacles. The contribution of this work is to use RRT planning for 3D state space, where the motion segment or motion primitive connecting the two consecutive states should be defined in a 3D space while satisfying the motion constraints of a UAV. The simulation includes setting up a 3D map, providing the starting and destination pose, planning a way using RRT and 3D Dubins moving primitives, smoothing the acquired trajectory, and simulating the UAV flight. The results obtained demonstrate that the smoothed-generated waypoints significantly improved tracking in general with shorter paths.