Git Product home page Git Product logo

intersect's People

Contributors

noonat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

intersect's Issues

just to say

I was looking at your article all day long and found it again, so happy ;) thx

Sweeping non-moving objects

The annotated source says "If the sweep isn’t actually moving anywhere, just do a static test. It’s faster and will give us a better result for that case."

and then the code goes on to show:

    if delta.x == 0 and delta.y == 0
      sweep.pos.x = box.pos.x
      sweep.pos.y = box.pos.y
      sweep.hit = this.intersectAABB(box)
      if sweep.hit?
        sweep.time = sweep.hit.time = 0
      else
        sweep.time = 1

Shouldn't sweep.pos.x = box.pos.x actually be sweep.pos.x = this.pos.x? If the object isn't moving, why would the position be the object you are colliding with?

(BTW, this has been a great resource! I've ported it more or less directly to a single C header file along with the tests: https://github.com/sponge/sdlgame/blob/master/src/sweep.h it mostly seems to be working besides a couple of weird edge cases that I'm not sure are my fault or are present in the original. I won't make any claims about how good my C is, though!)

AABB.intersectSegment returns NaN in hit collider response object

my setup data:

pos = new Point(907.5, 318.5)
half = new Point(7.5, 17.5)

myAabb = new AABB(pos, half)

start = new Point(531, 301)
delta = new Point(16, 0)
result = myAabb.intersectSegment(start, delta)
console.log('result:', result)

/*
prints:

result: Hit {
  collider: AABB {
    pos: Point { x: 907.5, y: 318.5 },
    half: Point { x: 7.5, y: 17.5 }
  },
  pos: Point { x: NaN, y: NaN },
  delta: Point { x: NaN, y: NaN },
  normal: Point { x: 0, y: -1 },
  time: NaN
}
*/

Any ideas what's going on here? When I look at the internal implementation I see nearTimeY is being set to NaN

question on a previous commit

I've been using this library for years, it's amazing! Today while looking through the commit history of this project, I noticed there is one change made that actually has to do with intersection test changes: a67d18c

The commit message is fix hit delta calculations, but looking at the changes it's unclear to me what bug is being resolved. Could you clarify this one change please?

Thanks again for an amazing resource!

AABB vs circle?

I think it would be helpful for there to be an additional section for the intersection of AABBs and circles.

Is the coordinate system messed up, or am I stupid?

I'm currently following this tutorial in hopes of accurately recreating it in Lua. However, immediately starting from the AABB vs Point section, I had issues with the coordinate system.
The point would be detected when it shouldn't, wouldn't be when it should, hit values aren't accurate, etc.

So I ask, what exactly is the coordinate system used here? Is it based on the center? The top-left?
I'm guessing the latter since this is likely used with canvas, but I have issues there, too.

I think the easiest way for me to debug this is to ask: how did you create the visualization in the AABB vs Point section? If I can know that, I'd be able to debug it, I think.
Thanks for the great tutorial!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.