bevy_xpbd
bevy_xpbd copied to clipboard
Rename raycasting and shapecasting methods in `SpatialQuery`
trafficstars
Objective
Currently, the following names are used for raycasting/shapecasting methods:
cast_rayray_hitsray_hits_callbackcast_shapeshape_hitsshape_hits_callback
While these are fine, they could be improved. The distinction between cast_ray and ray_hits isn't immediately obvious from the name, and the naming isn't very consistent. In addition, a more common and perhaps cleaner name for cast_ray is raycast.
Solution
Rename the methods to be cleaner and more consistent:
cast_ray→raycastray_hits→raycast_manyray_hits_callback→raycast_callbackcast_shape→shapecastshape_hits→shapecast_manyshape_hits_callback→shapecast_callback
The old methods still exist, but have been deprecated and will be removed after the next release.
Migration Guide
let before = spatial.cast_ray(...);
let after = spatial.raycast(...);
let before = spatial.ray_hits(...);
let after = spatial.raycast_many(...);
let before = spatial.ray_hits_callback(...);
let after = spatial.raycast_callback(...);
let before = spatial.cast_shape(...);
let after = spatial.shapecast(...);
let before = spatial.shape_hits(...);
let after = spatial.shapecast_many(...);
let before = spatial.shape_hits_callback(...);
let after = spatial.shapecast_callback(...);