hello,
I have a problem because I have to implement a small demo with collision detection. I know A LOT about how it works, I think I would use AABB (axis aligned bounding box) BUT how should it look like in code ?
For example so that you will understand me(I use c++ + OpenGL):
I have and object and I want to check if it's colliding with anything I can check if something is in my defined box volume but how ? I have my object's coords and all the others objects' coords but how to check which of them are colliding?
Can you show me some practical example ?
Collision detection how to start ?
could you explain in detail what you DO know? I have implemented it myself, but what exactly DONT you know?
edit (sorry, a few edits here, not quite in my best shape):
I guess I can add some info instead of just asking...
//for horizontal check
if(a.left>b.right || a.right<b.left)return;//no collision
edit (sorry, a few edits here, not quite in my best shape):
I guess I can add some info instead of just asking...
//for horizontal check
if(a.left>b.right || a.right<b.left)return;//no collision
I just know a lot about it in theory but I don't know how to implement it in practice. btw I have found very interesting site about collision detection (theory)
http://www.metanetsoftware.com/technique/tutorialA.html
I don't even know how to start.
http://www.metanetsoftware.com/technique/tutorialA.html
I don't even know how to start.
added some info in my earlier post. got it wrong the first time, should not post while half asleep....
that's what I mean, you haven't really asked a question. it's just a random request for information. what is it you do not know. are you looking for performance improvements? it did not sound like it. have you implemented anything yet? it did not sound like it. give us more information, or you will end up with random information to that random question.
what is high level design?
what is high level design?
Ok, sooo... I haven't yet implemented anything regarding collision detection. What I am asking is how to structurise objects, how to organize them so that they will detect collisions.
For example I have came to idea like this :
I will have abstract class sprite from which all objects will derive from, then on constructor all of the objects will be pushed on the let's say vector, deque or STL list and then the collision detection funciton will first check which of the other object is in the particular checked object's range (aabb) and do the test.
Is it the right approach ? Or how does the industry standard look like ?
For example I have came to idea like this :
I will have abstract class sprite from which all objects will derive from, then on constructor all of the objects will be pushed on the let's say vector, deque or STL list and then the collision detection funciton will first check which of the other object is in the particular checked object's range (aabb) and do the test.
Is it the right approach ? Or how does the industry standard look like ?
The metanet N tutorials are excellent. That's how I got started with vector math and collision detection. The little ragdoll physics in N is really cool :)
It's still not clear what you are asking about though. You seem to have a good grasp already.
Yes, you would need an array or some other form of list for your sprites so that you could iterate them all. It depends on your own implementation. It could be a basic, linear array or it could be some form of hierarchical list, like a binary, quad or octree. It could be a linked list. Or some combination of.
It's still not clear what you are asking about though. You seem to have a good grasp already.
Yes, you would need an array or some other form of list for your sprites so that you could iterate them all. It depends on your own implementation. It could be a basic, linear array or it could be some form of hierarchical list, like a binary, quad or octree. It could be a linked list. Or some combination of.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement