0
votes
0answers
22 views

Multiple box collisons [closed]

With my basic player here I want to have multiple boxes and stuff. I'm trying to get the player to colide with all sides of the box without having to make a huge box class with tons of if statements ...
-2
votes
1answer
74 views

Calculate velocity of a bullet ricocheting on a circle

I made a picture to demostrate what I need,basecaly I have a bullet with velocity and I want it to bounce with the correct angle after it hits a circle Solved(look the accepted answer for explain): ...
0
votes
3answers
135 views

What is the easiest way to make an object follow the edge of a sprite?

I have a rounded rectangle sprite and another sprite that's just a circle. I want the center of the circle to follow the edge of the rounded rectangle. Is there any easy way to accomplish this task? ...
1
vote
1answer
111 views

2D Collision in JavaFX - Bad accuracy with .intersects()

I have several Shape objects - Circle, Rectangle and Polygon. I use the built-in .intersects(Bounds1, Bounds2) method to detect collision but it's quite inaccurate. Circle c1 = new Circle(20); ...
0
votes
2answers
82 views

Artillery Simulation [duplicate]

I need some help on a simulation of an Artillery like this one https://www.youtube.com/watch?v=YktWSKo_UbA. I cant figure out how to make the "tomato" to get to the selected spot. Where can I get ...
4
votes
1answer
228 views

How do I make a cube move by rolling?

I am learning jMonkeyEngine by making some small games with it. I have a simple rectangular cube that I want the player to be able to roll around the game world. When he presses the arrow keys, the ...
0
votes
0answers
114 views

Polygon Collision Response

I'm working on a game engine that has a built in custom physics engine (I know it's a waste of time, but I have years to make this, so why not make it good?). Currently, with any number of polygons, ...
0
votes
1answer
126 views

Grid collision - finding the location of an entity in each box

I am trying to implement grid-based collision in a 2d game with moving circles. The canvas is 400x400 pixels. Below you can see the code for my Grid class. What I want it to do is check inside which ...
-2
votes
2answers
107 views

How to calculate a bounding rectangle of a polygon?

Polygon poly = new Polygon(); poly.getPoints().setAll(5d, 15d, 15d, 25d, 5d, 30d); How do I calculate the Polygon's height and width? There is no poly.getWidth() or poly.getHeight() method in ...
0
votes
0answers
50 views

Lateral Friction Phisics

I am trying to create a physics engine for my game, and need to cancel out any lateral velocity for when entities turn. I have tried to mimic this page's example, but it is not working. I have objects ...
2
votes
1answer
353 views

3d Water Simulation formula questions

I have created a Grid: At each point along the grid, is a vertex (Intersection Points): Each of these points has an x,y,z position. Vector3f(x,y,z). In an attempt to animate the grid into a group ...
5
votes
2answers
416 views

How does this formula for generating water waves work?

I have been trying to implement the wave equation described in this paper ("Water Simulating in Computer Graphics," Kai Li and Liming Wu) in Java. Part of the paper discusses modeling waves as a sum ...
0
votes
1answer
285 views

Circle vs. Rect Collision accuracy problem

The blue ball is dynamic and is supposed to bounce off the walls, as well as the rectangle. Currently, the green rectangle is adding an invisible line to the scene, which doesn't let my ball go where ...
6
votes
1answer
305 views

2D Polygon Triangulation

I am creating a game engine using the JBox2D physics engine. It only allows you to create polygon fixtures up to 8 vertices, To create a body with more than 8 vertices, you need to create multiple ...
0
votes
1answer
287 views

Trouble with a modified parallax scrolling concept

I have a set of layers (each of them being a list of items) moving with different speeds as I mentioned here: http://stackoverflow.com/a/18962019/270197. Layers back in the scene move with slower ...
0
votes
0answers
857 views

Platform game: applying gravity and jumping [duplicate]

I am making a 2D platform game in Java but I don't know how to apply gravity and jumping on my player and other living creatures in game that it looks natural and that it is physical correct. I have ...
2
votes
1answer
267 views

How do I make my camera follow a Box2D object?

I'm implementing a camera in my game. It worked 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 center of the screen. ...
0
votes
0answers
51 views

Decaying velocity for simple ball physics [duplicate]

I am writing a little experimental 2D program in Java to understand the basics of physics in games. I read this article on game physics to get me started and want to implement the simple Euler method ...
0
votes
1answer
146 views

Simulating building stress [closed]

I need to simulate the effects of adding supporting materials to a building structure for a genetic algorithm in a block-based world. Essentially I am planning to use a genetic algorithm to optimise ...
1
vote
1answer
252 views

Pick and Drop the Ball Testing Without Replicating the Physics Frame

I am making a program that pick, drag, and drop the ball. In real life, once you pick the ball and drop it, whenever the available object is (what you see is what you get) will only be picked and ...
4
votes
1answer
416 views

Splitting logic into threads in Java tower defence game

I'm making a tower defence game in Java! It's my first game development. I want to know how many threads Do I need to create in a game, to split logic.. I've made this one: Main App thread (adds ...
0
votes
1answer
173 views

SFX Played Once per Collision or Hit

I have a question about using Box2D (engine for LibGDX used to make realistic physics). I observed on the code that I've made for the physics here below: @Override public boolean touchUp(int screenX, ...
-2
votes
1answer
219 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 ...
2
votes
5answers
1k views

How to Make Objects Fall Faster in a Physics Simulation

I used the collision physics (i.e. Box2d, Physics Body Editor) and implemented onto the java code. I'm trying to make the fall speed higher according to the examples: It falls slower if light object ...
1
vote
1answer
328 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) * ...
1
vote
2answers
187 views

Perpendicularity of a normal and a velocity?

I'm trying to fake angular velocity on my vehicle when it hits a wall by getting the dot product of the normal of the edge the car is hitting and the vehicle's velocity: Vector2D normVel ...
4
votes
4answers
644 views

Point of contact of 2 OBBs?

I'm working on the physics for my GTA2-like game so I can learn more about game physics. The collision detection and resolution are working great. I'm now just unsure how to compute the point of ...
1
vote
1answer
129 views

Help with Collision Resolution?

I'm trying to learn about physics by trying to make a simplified GTA 2 clone. My only problem is collision resolution. Everything else works great. I have a rigid body class and from there cars and ...
1
vote
1answer
373 views

Rotating a cube using jBullet collisions

How would one go about rotating/flipping a cube with the physics of jBullet? Here is my Draw method for my cube object: public void Draw() { // center point posX, posY, posZ float ...
0
votes
2answers
561 views

Circle physics and collision using vectors

This is a problem I've been having, When making a set number of filled circles at random locations on a JPanel and applying a gravity (a negative change in the y), each of the circles collide. I want ...
1
vote
1answer
444 views

Change density of the body dynamically

In my game, I want to change density of my body object when it collide with other objects. I found something like following to change density but further I could not able to find any hint for this. So ...
1
vote
1answer
591 views

Box2D platformer movement. Should i mess with velocity?

I have a platformer game in which I implemented the movement using a wheel attached to the hero. For jumping I use this: player.body.applyLinearImpulse(new Vec2(0, 30000000), ...
1
vote
1answer
1k views

JBox2D applyLinearImpulse doesn't work

So i have this line of code: if(input.isKeyDown(Input.KEY_W)&&canJump()) { body.applyLinearImpulse(new Vec2(0, 30), cam.screenToWorld(body.getPosition())); ...
0
votes
1answer
223 views

Calculating an orbit and approach velocties

I have drones in my game that need to approach and orbit a node and shoot at it. Problem is I want to stay away from a real physics simulation, meaning I don't want to give the node and drone a mass ...
1
vote
1answer
4k views

LibGDX Box2D Body and Sprite AND DebugRenderer out of sync

I am having a couple issues with Box2D bodies. I have a GameObject holding a Sprite and Body. I use a ShapeRenderer to draw an outline of the Body's and Sprite's bounding boxes. I also added a ...
5
votes
1answer
3k views

Box2D Difference Between WorldCenter and Position

So this problem has been brothering for a couple of days now. First off, what is the difference between say Body.getWorldCenter() and Body.getPosition(). I heard that WorldCenter might have to do ...
4
votes
4answers
2k views

Which Side Was Hit?

I am working on an Android game and I have two objects A and B (both rectangles) and when they collide I simply want to know which side of B was hit. I have detected the collision fine, but I am ...
-1
votes
1answer
1k views

Ball Physics for Android Game

I am starting work on a new Android game and I haven't had any experience implementing physics before. I am trying to steer clear of external libraries such as box2d, not just because I think it is ...
11
votes
1answer
2k views

Should I write my own physics engine, because of networking integration?

I'm currently developing a top down, realtime, zombie shooter. I'm coding this in Java, using JBox2D as my physics engine. I have been coding the networking this week, and am now up to the physics ...
4
votes
3answers
3k views

Why is my velocity decaying?

Programming in Java. Tinkering around with physics. My entities all have position and velocity. In the main loop, all I'm doing is applying gravity and bouncing off the edges, like so: // add ...
2
votes
1answer
813 views

Converting 2D Physics to 3D

I'm new to game physics and I am trying to adapt a simple 2D ball simulation for a 3D simulation with the Java3D library. I have this problem: Two things: 1) I noted down the values generated by the ...
10
votes
3answers
6k views

Is there an algorithm for a pool game?

I am looking for algorithm to calculate direction and speed of balls in a pool game. I am sure there has to be some type of open source code for this since pool games are some of the oldest computer ...
4
votes
2answers
1k views

2D game - Missile shooting problem on Android

I have to make a tank that sits still but moves his turret and shoots missiles. As this is my first Android application ever and I haven't done any game development either, I've come across a few ...
5
votes
2answers
468 views

Physics in my game confused after restructuring the Game loop

I'm on my way with making a game in Java. Now I have some trouble with an interpolation based game loop in my calculations. Before I used that system the calculation of a falling object was like ...
1
vote
3answers
876 views

What's the best open source physics engine to use with JOGL? [closed]

I have a past with jbullet but the existing jogl compatible sources and demos seems uncompleted. I have managed to implement it to an extent but still looking for a better documented engine with more ...
4
votes
1answer
2k views

New Vector Calculation for Elastic Collision of Circle and Fixed Rectangle

I am writing a fairly simple breakout-style game for Android phones. I have successfully detected the collisions between the ball(s) and bricks. The problem that I am having is in calculating the new ...