Tag Info

New answers tagged

2

Sorry everything would look nicer if latex formatting would be possible. Let's consider three gears: G1, G2 and G3. Now each gear has a given radius r1, r2 and r3. The problem is to find the angular velocity for each gear (denoted av1, av2 and av3). From a physics course we know that the tangent velocity v is proportional to the radius: v1 = av1 * r1. ...


1

If you eventually end up going with the pre-rendered shadow approach, or any other texture based solution... To save some memory, and maybe also to be able to soften up the edges of the shadow (maybe even contact hardening shadows), have you considered using distance field textures? They are useful for monochromatic textures (decals, fonts and shadows!), ...


0

You're assumption that you do not need any physics is wrong, anytime you are dealing with moving objects in 1D, 2D, 3D... environments and you need to detect if two objects will collide then you are doing physics calculations. You can not get away from it. Returning true or false is easy, but figuring out if a collision has happened or not can range from ...


2

Box2D has a Java library. It might be a bit more than you need but it's pretty robust and used in all sorts of projects. Maybe someone else can recommend a better library solely for collision detection. If you want to roll your own solution, which would probably be better if you want to keep it simple, you'll need to look into Oriented Bounding Box (OBB) ...


0

A nice but lesser well known algorithm for this situation is called dimensional reduction. If you keep your list of rectangles sorted on one axis (say, x axis by sorting on the minimum x value of the rectangles), then collision detection just becomes a 1 dimensional overlap test on the y axis, for whatever overlaps there were on the x axis. Works better ...


0

In the worst case (for 40 AABBs) you'll need to do 780 tests. There's not going to be any problems with a simple 4 comparison test: a_min.x <= b_max.x b_min.x <= a_max.x a_min.y <= b_max.y b_min.y <= a_max.y If all of these are true, you have an intersection. At this point partition structures (like AABB trees) are not necessary at all. You ...


3

You may want to consider looking to spacial partitioning, such as a Quadtree. In a nutshell, you would be dividing your world into sub-sections, and only check collisions between objects that are inside of the same sub-sections, greatly improving the complexity.


1

You can use the even-odd algorithm. In summary it does the following. Loop thru each scan line Intersect the scan line with each polygon edge Sort the intersection points by x value Fill interior pixels between intersection points using the even-odd rule to determine interior points Note, you have to guard against degenerate cases like intersecting with ...


-1

For game maker you can use this tutorial https://youtu.be/LUw78Tk70bM



Top 50 recent answers are included