This paper describes a collision detection and path planning algorithm in 3D time-varying environment using octree data structure. The problem is decomposed into two operation steps. First, all the moving obstacles are removed from the environment so that a collision- free path is planned in the 3D stationary environment. Second, all the moving obstacles are returned to the workspace and the 3D volume swept by their motion is represented in the form of an octree. In case of a collision, the colliding obstacle is placed at the collision point as a new stationary pseudo-obstacle and a new path is planned from the last to the final position of the robot.