This paper presents a new method for editing an existing motion to satisfy a set of user-specified constraints, and in doing so guaranteeing the kinematic and dynamic soundness of the transformed motion. We cast the motion editing problem as a constrained state estimation problem based on the per-frame Kalman filter framework. To handle various kinds of kinematic and dynamic constraints in a scalable fashion, we develop a new algorithm called spacetime sweeping, which sweeps through the frames with two consecutive filters. The unscented Kalman (UK) filter estimates an optimal pose for the current frame that conforms to the given constraints, and feeds the result to the least-squares (LS) filter. Then, the LS filter resolves the inter-frame inconsistencies introduced by the UK filter due to the independent handling of the position, velocity, and acceleration. The per-frame approach of the spacetime sweeping provides a surprising performance gain. It is remarkable that now editin...