Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
2D refers to two dimensional space where coordinates are represented with X and Y values.
35
votes
Accepted
Hexagon collision detection for fast moving objects?
The solution is actually simpler than expected. The trick is to use Minkowski subtraction before your hexagon technique.
Here are your rectangles A and B, with their velocities vA and vB. Note that v …
25
votes
a simple 2D rectangle collision algorithm that also determines which sides that the rectangl...
Adapted from my answer to "Which Side Was Hit?":
I suggest computing the Minkowski sum of B and A, which is a new rectangle, and checking where the centre of rectangle A lies relatively to that new r …
20
votes
Accepted
Sorting array of points in clockwise order
Your question is not precise enough. An array of points is only « clockwise » or « anti-clockwise » relative to a reference point. Otherwise, any array of three points can always be either CW or CCW. …
15
votes
Accepted
Fastest way to render lines with AA, varying thickness in DirectX
If you are going to render Y = f(X) graphs only, then I suggest trying the following method.
The curve data is passed as texture data, making it persistent, and allowing for partial updates through g …
8
votes
Accepted
Rotating a group of sprites - How to calculate origin
If you have three sprites (or if they have very specific relative positions, which almost never happens) there is a special point called the circumcentre which is at an equal distance of each sprite. …
7
votes
Accepted
What kind of projection is used here?
You guessed properly. The orthographic projection you came up with is the one used for most of the objects. You can tell because parallel lines in the X, Y or Z directions all become parallel lines, i …
7
votes
Optimal sprite size for rotations
I think what you are trying to do is the 2D image space equivalent to double rounding. …
6
votes
Accepted
How to draw equal length line stripes on a parabola?
The derivative of the ball position is:
dx/dt = vx
dy/dt = vy + gravity * t
So the derivative of the parabola arc length s is, using Pythagora’s theorem:
ds/dt = sqrt(vx² + (vy + gravity * t)²)
…
6
votes
Accepted
Physics/Logic behind self-bounce
If I was the ball, I think I would try to 1. maximise the surface of contact with the ground and 2. maximise the vertical compression so that the release will generate forces that are normal to the gr …
3
votes
Different ways to store a 2D map/landscape in XNA
There are a lot of different ways to store this information. I would suggest using something standard, though. For instance a lot of opensource games use the TMX map format as used by the Tiled editor …
3
votes
Accepted
Collision method for multiple circles
In this line:
double targetY = circle1.getLayoutX() + Math.sin(angle) * minDistance;
Certainly you meant getLayoutY.
As a side note, it is useless to compute angle = atan2(y,x) if the only thing y …
3
votes
Accepted
Perlin noise looks uncoherent on higher z
Here:
perlin.lerp(v, perlin.lerp(u, perlin.grad(self[AB + 2], x , y , z - 1),
This should have AA + 2 instead.
2
votes
Calculating the 2D edge normals of a triangle
Here is a method that works:
get a vector normal to the triangle, for instance p1p2 ^ p1p3
for each edge, take the result of its cross product with that vector
normalize
If your triangles are in a 2D …
2
votes
Isometric smooth fog
Here is a simple proposal: you could try modulate the fog intensity for each cell. Here is an example of applying a simple convolution filter:
float fog = 0.0;
for (int dj = -3; dj <= 3; dj++)
for (i …
2
votes
Why is my collision resolution failing on the corners?
Maybe this:
elif sides & LEFT:
Should actually be this:
if sides & LEFT:
Otherwise the left/right branches are never visited when there is a top/bottom collision.
The first part o …