Tag Info

Hot answers tagged

5

I have good news and bad news for you: The Bad News: I don't know or remember any Java library that does what you want The Good News: It's really easy to implement this type of algorithm yourself! Here's a couple, you can mix them to optimize your collision detection depending on the type of shape. BB Collision Detection You can imagine a box around ...


3

As already pointed out in the comments and answer: This can be arbitrarily complex. Particularly, depending on the exact use case and performance requirements, you can employ some rather sophisticated data structures in order to make these tests fast. The bounding box test is the simplest one that should be done in any case (and in fact, could already be ...


2

It means desktop. You have two options to deploy your libGDX app to the desktop: Create a self-runnable JAR. This is easier (Eclipse can export it pretty easily). Create an EXE, via launch4j (or some other wrapper). This is possible too (especially with Gradle). I've used both approaches and they work equally well as far as I can tell. Both rely on ...


1

Imagine the radius is one. That means every point around the circle is exactly one unit away from the center. Now what kind of vectors always have a length of one? Unit vectors of course. You can get a unit vector by normalizing a non-unit vector. Take the vector CA (center to A). Next, normalize CA to make it a unit vector, then scale it by the radius of ...


1

One obvious solution is to store the entityId inside each component structure or class. This way when you need to obtain components or do some entity-specific logic, you already have an easy way to obtain the entityId based on a given component. Another solution that may be a tad more complex but has some useful side affects is to assign each component a ...


1

yeah, all solutions have already been made... i'll just add some more code (i'm rather from stackoverflow ^^) assuming you're using bounding box assuming you use plain java (java.awt) . List<Shape> shapeList = ...; //you know where you get them Shape exampleShape = shapeList.get(0); Rectangle2D boundingBox = exampleShape.getBounds2D(); see ...


1

If you know the canvas is a rectangle then this simplifies to the case of checking if the bounding rectangle of the shape being drawn is contained within the canvas' rectangle. That's a fairly efficient check to run, and (generally) finding the bounding rectangle for your shape should be fairly easy (just finding the minimum and maximum x and y coordinates) ...



Only top voted, non community-wiki answers of a minimum length are eligible