In an embedded cluster, with high stellar densities, interactions can occur between stars and either newly formed diffuse protostars or high‐density regions produced by the collision of turbulent elements. It is shown by smoothed particle hydrodynamics (SPH) modelling that interactions can occur in which the complete protostar, or high‐density region, is extended into a filament and where planetary‐mass condensations in the filament are captured by the star. Other condensations can escape to form free‐floating planets. The SPH code used for this modelling contains a novel algorithm for radiation transfer that is applicable over all scales, all opacities and all optical depths. The captured protoplanets have orbits with initial semimajor axes mostly in the range 1000–2000 au, although occasionally larger or smaller, and with high eccentricities (∼0.7–0.9). Motion in a resisting medium, at least partially a by‐product of the interaction, gives a range of final orbits fully consistent with observations and suggests types of orbit that are, as yet, not amenable to detection. Estimates of the frequency of planetary companions for solar‐type stars comfortably satisfy the current 7 per cent observational estimate and even suggest that the frequency may turn out to be higher when planets of lower mass and larger orbits can be detected.