Hello. There was nothing and tried to implement a physics engine based on the Verlet Integration. So far, only the behavior of material points and constraints. I also want to ask - how to implement a collision in my algorithm? Source: Code here
You have to put it in your Dropbox's "pub" folder to share a link. I really want to try this out (and look at the code, of course ;)!
Sorry? I use dropbox just firts time. Update first post.
Collision detection itself isn't really that hard. The problem is trying to get the culling right so the collision detection doesn't get too slow.
The most basic collision detection is circle-on-circle, which can be found by seeing of the center of the smaller circle is a shorter distance away than the radius of the larger circle. There might be better way to do this, but this is the most basic way I could think of.
Rectangles are not too bad either, assuming they are oriented the same way as the axes of the coordinate system. If not, you need to do oriented bounding box collision detection using the parallel axis theorem or something. Just a bit a linear algebra there.
Not too sure about triangles though.
As for culling, most implementations of 2D collision detection tend to use quartic trees, I believe. Chipmunk uses a hash instead, but I hear the algorithm is much more complicated. The reward for the underlying hash is the speed of course.
However, Chipmunk uses Euler integration, so it should be interesting to see how the two stack up, if you ever get to implementing collision detection as well. Still, even with good culling, most of this stuff gets pretty slow fairly quickly. Thus, if you know C, it would be cool to see this re-implemented in C.
Hope that's enough to point you in the right direction.
I assume the blue-white lines show where the image is supposed to go? I'm pretty sure that line you posted is correct, so it would be helpful to see the code as a whole to see what the problem is. Any chance you could throw it in a gist? It'd be cool to get a few of us to hack at this together, but I can understand if you'd rather go it alone and just pop in for some hints every now and then.
Without knowing anything about the context of this code snippet, one small part kind of jumps out at me as probably wrong:
Is this copy-pasted from the actual source or did you retype it? Are you sure 2 is the correct index here, when 1 is used for the x? :)
Sorry that he wrote just a line of code, just the whole it is not very "handsome". In the problem figured out as soon as decorated as gem (who suddenly come in handy) and want to do a complete physical library. Can be obtained and it will be useful to someone.
Eh! I've had a long day granted but that made no sense to me.
you need some leisure time, basic, make some time for leisure, there are a few leisure activities available to the interested person: sailing, running, gardening, swimming. You should choose one of them and undergo relaxation and pleasure etc.
If I had the time I would; except for the running, and gardening. Oh not going sailing ether. hmm don't like swimming in pools now that I think about it :( and I live in Scotland so swimming in the sea is reserved for New Years day only.
Suppose I could sit out side in the snow/rain/fog/cloud with iPad, relax and play some games.
You midpoint calculations are fine, (unless the cube has already been rotated, then you might get some unexpected results).
Without full code its hard to see the problem.
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill