I bet this has been asked a lot of times so I am sorry in that case.
Anyways; bullet collision!
I am struggling hard at getting a good bullet collision code together and I have not yet found someone who has already a good solution I could either steal or port.
Basically the problem:
Bullet goes from A to B through a box. Because the bullet is so fast it misses the box even though it went right through it if you use a normal collision detection code that only checks if the bullet is in the box. I really dont want to just use a loop and try each pixel for collision cause that sounds silly. I want a function that basically gives me the position of the intersection.
Ex:
I've watched this video on AABB Line-box intersection collision code but I can't seem to get it to work that well.
If you wish to try my version go ahead: love file made for love2d 0.9.0
You can move around the points but not the box itself. The collision code is in the box.lua file. Don't mind the package stuff, its kinda irrelevant to this
What do you mean my bullet is not a point? In my example .love file I only have two points just to mark the bullet and where its potentially going to be next step.
And you link is quite confusing, I lost track of what they meant after the like 3rd sentence.
Does anyone got a good solution for the collision detection I need?
And Azhukar if your link is a good answer then please explain what they mean with all the Ax B*s Xasgaege whatev
jag_e_nummer_ett wrote:Yea you know what f this, I am taking help from another source, not someone like you that just sends a link he got from his google results.
I can tell you're going to get far in this endeavor. Just because you're 16 doesn't mean you have to act like it, have patience and try to read through it.
jag_e_nummer_ett wrote:Yea you know what f this, I am taking help from another source, not someone like you that just sends a link he got from his google results.
I can tell you're going to get far in this endeavor. Just because you're 16 doesn't mean you have to act like it, have patience and try to read through it.
I really dislike people like you that just look down on everyone on the internet. Idk what to reply, I'll go try learn about vectors now and hopefully you can help me at that point
jag_e_nummer_ett wrote:I really dislike people like you that just look down on everyone on the internet. Idk what to reply, I'll go try learn about vectors now and hopefully you can help me at that point
Perhaps you have an inferiority complex? I'm not looking down upon you, merely stated you're acting out emotionally when there was no cause to do so, which was in response to you telling me to fuck off because I didn't code it for you. I provided you with help as to how you can achieve the collision results you want.
Just a small question, do you prefer using vectors or normal coordinates when using love2d? Or is there no difference?
Azhukar wrote:
jag_e_nummer_ett wrote:I really dislike people like you that just look down on everyone on the internet. Idk what to reply, I'll go try learn about vectors now and hopefully you can help me at that point
Perhaps you have an inferiority complex? I'm not looking down upon you, merely stated you're acting out emotionally when there was no cause to do so, which was in response to you telling me to fuck off because I didn't code it for you. I provided you with help as to how you can achieve the collision results you want.
Ok I've chilled out now
You know what I think you're right idk why but I seem to get in fights all the time. I usually ask for help when I am tired and I bet thats a problem. I apologise and I appreciate that you're still here.
jag_e_nummer_ett wrote:Just a small question, do you prefer using vectors or normal coordinates when using love2d? Or is there no difference?
Depends on the situation, in this case I think vectors will solve the overshooting issue much more efficiently and easier than continuously checking bullet position "per pixel".
Easiest would be to check whether the bullet vector intersects with any of the 4 rectangle sides, then picking out the point closest to bullet origin (the point from which the bullet vector begins).