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

Use a small Box interface instead of a full Thing for collision detection #190

Open
JoshuaKGoldberg opened this issue Jul 12, 2020 · 0 comments
Labels
difficult This is a hard issue. You'll want to get a few smaller ones done before trying it. status: accepting prs Go ahead and send a pull request to resolve this issue! type: cleanup Improving code architecture and/or cleanliness.

Comments

@JoshuaKGoldberg
Copy link
Member

Packages that deal with the physics engine (i.e. QuadsKeepr and ThingHittr) take in full IThings and look at direct members such as .left. It'd be better to move space-related things in the IThing interface to a member, like box: IBox. At its simplest it would probably look something like:

interface IBox {
    top: number;
    right: number;
    bottom: number;
    left: number;
}

This might be dependent on #189 so that the box doesn't require offsets (so that things just barely not touching each other's quadrants can still collision detect).

Open question: should this box contain xvel and yvel? If so, is "box" the right term? As with Thing->Actor, what does everyone else call this thing?

@JoshuaKGoldberg JoshuaKGoldberg added difficult This is a hard issue. You'll want to get a few smaller ones done before trying it. status: accepting prs Go ahead and send a pull request to resolve this issue! type: feature Suggested enhancement or new ability. type: cleanup Improving code architecture and/or cleanliness. and removed type: feature Suggested enhancement or new ability. labels Jul 12, 2020
@JoshuaKGoldberg JoshuaKGoldberg changed the title Use a small IBox interface instead of a full IThing for collision detection Use a small Box interface instead of a full Thing for collision detection Aug 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficult This is a hard issue. You'll want to get a few smaller ones done before trying it. status: accepting prs Go ahead and send a pull request to resolve this issue! type: cleanup Improving code architecture and/or cleanliness.
Projects
None yet
Development

No branches or pull requests

1 participant