Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename raycasting and shapecasting methods in SpatialQuery #269

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Jondolf
Copy link
Owner

@Jondolf Jondolf commented Nov 30, 2023

Objective

Currently, the following names are used for raycasting/shapecasting methods:

  • cast_ray
  • ray_hits
  • ray_hits_callback
  • cast_shape
  • shape_hits
  • shape_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_rayraycast
  • ray_hitsraycast_many
  • ray_hits_callbackraycast_callback
  • cast_shapeshapecast
  • shape_hitsshapecast_many
  • shape_hits_callbackshapecast_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(...);

@Jondolf Jondolf added the A-Spatial-Query Relates to spatial queries, such as ray casting, shape casting, and intersection tests label Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Spatial-Query Relates to spatial queries, such as ray casting, shape casting, and intersection tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant