Hot answers tagged collision-detection
3
There are many specific circumstances related to your code (that you haven't posted). For instance, do you update position before or after checking for collisions? Do you always apply changes to position, or are they sometimes skipped? Do you apply any extra position change in order to resolve a collision? When your ball gets "inside" player, is it still ...
3
I would combine the platform tiles into a single platform entity.
For example, say you take the 3 tiles from the pictures and combine them into a single entity, your entity would have a collision box of:
Left = box1.left
Right = box3.right
Top = box1.top
Bottom = box1.bottom
Using that for collision will give you the y as the least penetrating axis ...
3
You are going to need to do your move/collision in two steps, once for the horizontal direction, and another time for the vertical direction.
Move Horizontal
Check for horizontal collision - adjust position if needed
Move Veritcal
Check for veritcal collision - adjust position if needed
Doing the collision check like this should solve your stuttering ...
2
Demonstration:
Crude but functional collision detection and response
Video:
https://vimeo.com/64923588
The idea is that the player controlled sprite (actually a 32x32 pixels red box) can raise the speed of its next move, but it cannot go back to original speed except if it collide with something. Also if speed is enough the green wall can be "damaged" ...
2
Depends on which type of bounding box you're talking about.
Axis-aligned bounding cubes are one of the fastest ways to do a rough first-pass collision test, before sending those that pass to a more precise collision check. Edit: This is especially true when you have multiple moving objects that may collide with one another.
Oriented bounding cubes require ...
2
I believe that your manifold normals are incorrect. These AABBs will attempt to "push back" along the axis of the greatest intersection, however:
if(m.Normal.X < 0)
m.Normal = new Vector2(-1,0);
else
m.Normal= Vector2.Zero;
That code is saying "if B is further left than A, then the direction to resolve penetration is in the negative X axis, ...
2
You should describe what isn't working with your code, is it not properly detecting collision? Because then you should look at your collision detection function.
But in general, for 2d you should separate the checking of horizontal and vertical collision. If you do that then there won't be "diagonal collision", just a horizontal collision and a vertical ...
1
I have answered your question at Stack Overflow: http://stackoverflow.com/questions/16598466/andengine-tower-defence-game-enemy-weapon-interaction/16641973#16641973
Check it out for links to examples. I don't have enough reputation here to post more links.
The best way to approach this is to use Physics Box2D extension. It will handle the collisions for ...
1
during my experiments with HTML5 canvas and AABB I found exactly what you are experiencing. This did happen when I attempted to make a platform from adjacent boxes of 32x32 pixels.
Solutions I attempted by order of my personal preference
1 - Divide movements by axis
My current one, and I think I will continue my game with it. But be sure to check what I ...
1
The problem is is the order of your constructors. This works correctly. I put all the negative static Vector3 values into the min, and the positives into the max.
BoundingBox b = new BoundingBox(
Vector3.Left + Vector3.Forward,
Vector3.Backward + Vector3.Up + Vector3.Right);
BoundingBox bb = new BoundingBox(
Vector3.Left / 2 + Vector3.Forward / 2,
...
1
Here's a different algorithm; instead of stepping the player forward and moving him back if he's colliding, check where the next collision will occur:
Get the position of a corner of the object.
Shoot a line down (or up, or to the right/left, depending on your movement direction) from that position.
Figure out the first place that line intersects a ...
1
First of all, let me say that most calculations were done with integer maths because without FPUs real values were slooooooow.
I'd say that in the vast majority of cases it would be axis aligned rectangles, simply because that is the fastest way, which as Seth pointed out, is just a special case of separate axis testing.
In some cases collisions would be ...
1
Just to be clear: Per the convention of System.Drawing.RectangleF, rect.Top is a smaller value than rect.Bottom and so "up" is negative y.
Let's consider the case where the intersecting tile's center is above new player rect's center:
posDiff.y is negative.
collisionTop is true.
new player rect's Top is above tile's Bottom, otherwise there'd be no ...
1
A common way to do this is to divide the game world into tiles (which is something you may want to do for other reasons too) and have each tile store a list of the items in it. That way, you only have to check the items that are in the same tile as the character (or possibly in an adjacent tile, if the items and/or the character can overlap several tiles).
...
1
The terms overlap testing and intersection testing are largely synonyms. Neither does without context signify a specific method. Collision detection could also be said to be a synonym, but therm might in some cases be bit broader.
I'd describe these terms as the art of determining whether or not two figures in any place occupy the same space. Depending on ...
1
If you need a calculation in object space for any reason, just multiply by the object's inverse transformation to find positions and orientations relative to that object. This makes the position and orientation of that reference object zero and identity. All object's positions and orientations will be relative to this reference object.
To calculate the ...
1
It sounds like you already conceived of using planes to define arbitrarily shaped regions. It's not necessarily the most efficient method, but you can use them for collision detection. The planes can represent half-spaces, informally meaning that one half of space is on one side of the plane.
An axis-aligned bounding box is a specific case of using six ...
1
Little bit of necromancy here, but somehow it came back to the top of the list already today, and while a comment covers the idea, there aren't any actual answers yet. For the benefit of future readers:
The idea behind using an Axis Aligned Bounding Box, or in the 3D case a bounding cube, is that you can quickly disqualify some number of your potential ...
Only top voted, non community-wiki answers of a minimum length are eligible


