# Tagged Questions

42 views

### Java Angle Math: Calculate how near the player looks to an entity [duplicate]

I am programming a Minecraft Bukkit plugin and need a way to calculate an input number from 0 to 360 for displaying a custom compass / radar. So if the player directly looks at the object (shouldn't ...
157 views

### Implementing frame-independent friction

So I'm not looking for anything realistic like a physics engine, just want to say that first. I'm working on a simple top-down game and I'm trying to get friction working with deltaTime. This was my ...
146 views

### Ray picking and bounding boxes in Java

How do I check which bounding boxes (of different types) a ray, sent from the camera through the mouse-click coordinates, intersects with first in Java (and where)? I have arrays (box_X, box_Y, box_Z, ...
40 views

### Find angle between two points in java [duplicate]

I am making a very simple game and want the hunter to shoot the dragon when the player touches on the screen. I want the arrow to be craeted at hunterPosition.x and hunterPosition.Y and move towards ...
183 views

### Circle to Circle collision - bad accuracy

Circle1 (blue) is moving and its X and Y bounds are the screen (meaning it bounces off the walls). Circle2 (black) is stationary. Circle1(blue) is supposed to bounce off of Circle2 without ...
152 views

### Vector normalization gives very imprecise results

When I normalize vectors I receive very strange results. The lengths of the normalized vectors range from 1.0 to almost 1.5. The functions are all written by me, but I just can't find a mistake in my ...
136 views

### Calculate when round object is inside an ellipse

I want to calculate in java when a circle is inside an ellipse. I drew an example below: For this particular problem, the top left corner of the field has the position 0.0f, 0.0f. The bottom right ...
99 views

### Convert global rotation into local rotation

I have an object in my game and I have its location, rotation and scaling in separate float[3]. The location rotation and scale are all on the global axis; these do not change based on the objects ...
167 views

### Java moving image to where it is facing

I am trying to make an Asteroids type game. I searched and tried everything to move an image along its angle (as radiant). Using my knowledge of trigonometry I made the following calculation: x += ...
170 views

### Transforms in Box2D

I'm attempting to implement a camera in my game. I had it working for regular objects, but I began using Box2D and obviously things changed a bit. I have a Body object that I want to draw at the ...
187 views

### Making Ball Fling in a Curve Direction

I was wondering how to figuring out how to slice a ball (banana kick) by flinging it curve-ways. However, according to the LibGDX's gesture listener, the method for flinging only focuses on a straight ...
162 views

### Is this Rotation Matrix correct?

I'm having heavly troubles with setting up a View Matrix and a Projection Matrix. It simply doesnt work. So I think my problem is related to my rotationMatrix function. I'm using this tutorial to ...
123 views

### How do I derive the angular movement for a craft

I have the regular (linear) motion implemented like this: class Craft{ ... Vector location, velocity, acceleration, angularVelocity, angularAcceleration; ... //the move class responsible for linear ...
214 views

### Inventory Grid Detection

I'm working on creating an inventory system for a game. The inventory system will use cells and 2D images to represent items, like Minecraft, Diablo, or WoW. I've hit a bit of a snag when trying to ...
563 views

### LibGDX Perspective Camera for 2D

I'm very new to LibGDX and I'm trying to use DecalBatch with PerspectiveCamera, simply to have z-coordinate for my sprites, as SpriteBatch does not offer that. However, I don't know how to calculate ...
2k views

### Converting a 2D curve into points for data storage

I’ve created an algorithm which converts any curve i.e. path into minimum number of points so that I can save it into a file or database. The method is simple: it moves three points in equal steps ...
475 views

Possible Duplicate: How to convert mouse coordinates to isometric indexes? Okay, I apologise in advance if I make no sense here. Basically, I've got a simple application that takes in a ...
431 views

### Drawing isometric walls

I'm having some trouble with isometric walls. I'm drawing isometric floor tiles using the back to front rendering method, and it works fine. I also keep my floor tiles lined up properly in a nice ...
113 views

### Find the footprint of an isometric entity

I'm working on making a 2D isometric engine in Java. I'm getting into collision detection and I've hit a bit of a problem. Characters in-game are not restricted to movement from tile to tile - they ...
513 views

### Isometric - precise screen coordinates to isometric

I'm trying to translate mouse coords to precise isometric coords (I can already find the tile the mouse is over, but I want it to be more precise). I've tried several different methods but I seem to ...
192 views

### Move projectile in direction the gun is facing [duplicate]

Possible Duplicate: Move sprite in the direction it is facing? I am attempting to have a projectile follow the direction a gun is facing. When using the following code I am unable to make ...
276 views

### Point inside Oriented Bounding Box?

I have an OBB2D class based on SAT. This is my point in OBB method: public boolean pointInside(float x, float y) { float newy = (float) (Math.sin(angle) * (y - center.y) + Math.cos(angle) * ...
531 views

### (int) Math.floor(x / TILESIZE) or just (int) (x / TILESIZE)

I have a Array that stores my map data and my Tiles are 64X64. Sometimes I need to convert from pixels to units of tiles. So I was doing: int x int y public void myFunction() { getTile((int) ...
150 views

### Get all triangles that are < N dist from you?

Does anyone know of a way I could add a radius to this code for p? Like basically saying "this is true if the triangle is < N dist from the point" public boolean isPointInTriangle( Vector3f p, ...
2k views

### How to move an object along a circumference of another object?

I am so out of math that it hurts, but for some of you this should be a piece of cake. I want to move an object around another along its ages or circumference on a simple circular path. At the moment ...
348 views

### How do I convert sin, cos and tan into an int in Java?

How would you be able to change Math.sin, Math.cos and Math.tan into an int? This is because I heard that it is useful to have those Math resources in movement, gravity, etc. in gaming. Also, as a ...
883 views

### 3D: First Person Movement

I've searched and searched for a solution today but haven't found one. I have a Camera with Vector3 and also the camera has an angle. If I use this: hero.position.x += speedX; hero.position.z += ...
162 views

### Minimap Around Perimeter of Screen, Code Provided

What I'm essentially trying to do is what a lot of FPS's nowadays do in regards to their HUD. When an objective is off-screen, a small icon / symbol is shown on the perimeter of the screen, basically ...
593 views

### Relating a point after an image is panned and zoomed

For Android, let's say you have a image of a map that you draw inside your view. On this map there are many, many "hot spot" locations where you want your user to be able to select. Given that there ...
1k views

### Suggest a simple Java math library for matrix operations for use with OpenGL (lwjgl) [closed]

I'm writing an OpenGL app with Java. I need to do some math for camera and frustum culling (for AABB). Could you suggest a simple and fast Java math library for that?