-
Notifications
You must be signed in to change notification settings - Fork 242
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
feat: add ShapeCast function #247
Conversation
src/collision/Distance.ts
Outdated
const vertices = simplex.m_v; | ||
|
||
// Get support point in -r direction | ||
const indexA = proxyA.getSupport(Rot.mulTVec2(xfA.q, Vec2.neg(r))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW: In theory we could also write
const indexA = proxyA.getSupport(Rot.mulTVec2(xfA.q, r).neg());
Creates a Vec2 object less, but I don't think its worth it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's ok, I'm changing vector functions anyway
Think I found the problem, the test is wrong. Will try to fix it tomorrow! |
Works now, but the example has to be made a bit more accessible |
// GJK-raycast | ||
// Algorithm by Gino van den Bergen. | ||
// "Smooth Mesh Contacts with GJK" in Game Physics Pearls. 2010 | ||
export const ShapeCast = function(output: ShapeCastOutput, input: ShapeCastInput): boolean { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we put this in its own file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We would only have to export Simplex from Distance.ts. Would that be ok? Or should I move Simplex into its own file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nevermind actually, this is good, thanks
This is part of Box2d 2.4.1. There is currently a bug in my implementation, will take a look at it later again.