Skip to content

Box collision - #45

Open
Thrill12 wants to merge 9 commits into
mainfrom
box-collision
Open

Thrill12 wants to merge 9 commits into
mainfrom
box-collision

Conversation

@Thrill12

Copy link
Copy Markdown
Owner
  • added simple box collision detection
  • added tests
  • added transform, view, projection to color shader

@Thrill12 Thrill12 self-assigned this Jun 12, 2026

@Rinceri Rinceri left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey great work!!!! Very cool! Couple of comments but all logic etc. looks great.

If we're going to have a special docs page for it, do you want to do it as part of this PR or another one? Wouldn't mind if another one if you want to get this through ASAP

{
if (_bodies[i].ApplyGravity)
{
ApplyGravity(_bodies[i]);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be done in the same loop above? i.e. after j loop.

{
for (int j = i + 1; j < _bodies.Count; j++)
{
CheckCollisions(_bodies[i], _bodies[j]);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth redesigning this in the future. I'm not sure how computationally expensive this is, but it is $O(n)^2$!

Comment on lines +31 to +39
public Vector2 Forward
{
get
{
var radians = MathHelper.DegreesToRadians(rotation);
return new Vector2((float)Math.Cos(radians), (float)Math.Sin(radians));
}
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add docs for this property? Thanks

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit pedantic and personal preference but what do you think of having standard for test names? See here: https://learn.microsoft.com/en-us/dotnet/core/testing/unit-testing-best-practices#follow-test-naming-standards

Personally it makes test easier/quicker to read: from the test name itself, I know what method is being tested, how its being tested, and what is expected from it

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e.g. instead of Collision_Stay we do OnCollisionStay_Colliding5Frames_FireAction5Times

@Rinceri

Rinceri commented Jul 5, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #46

Edit well that doesnt work

This was linked to issues Jul 5, 2026
@Rinceri

Rinceri commented Jul 5, 2026

Copy link
Copy Markdown
Collaborator

I might remove #46 as part of the A/C is ability to zoom in/out. Will just update that issue

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Collision

2 participants