# Tag Info

Accepted

### What does linearDamping mean in Box2D?

I worked out a closed formula to calculate the velocity v' after some elapsed time t with a given ...
• 277
Accepted

### How to develop both a client and headless server together in Unity

Myself, I'd recommend keeping the server and client authored in a single Unity project. This minimizes the chance for mistakes where you change something in either the server or client and miss ...
• 136k
Accepted

### How to create a projectile motion of a cannonball in top down view?

From wikipedia: $$d=\frac{v_0^2}{g}sin(2\theta)$$ When you reverse the formula to find the angle from the distance and initial speed, it becomes: \eqalign{ d&=\frac{v_0^2}{g}sin(2\theta) \\ ...
• 5,324

### What does linearDamping mean in Box2D?

I looked at the Box2D source code, where it applies damping: v *= b2Clamp(1.0f - h * b->m_linearDamping, 0.0f, 1.0f); So the loss of velocity is certainly not ...
• 3,744
Accepted

### What is the physics behind a 2D gravity tunnel?

On collision with the field, set gravity to 0. While colliding with the field, multiply your velocity by a number between 0 and 1, like 0.999; This is called "damping", it simulates being inside a ...
• 611

### Java Libgdx Attaching Sprite to Box2D Body

Two (simple) solutions could look something like this: Give the player class a Sprite (best). ...
• 7,870

### What shape should you use for player collision?

Every collision shape has it's pros and cons: The axis aligned bounding box is very cheap to do collision against, but it's very rough and it's not possible to rotate it, thus it may need to be ...
• 15k
Accepted

### What is inertia in a physics engine?

I believe what we're looking at here more specifically refers to rotational inertia and inverse rotational inertia; not to linear inertia (nor inverse linear inertia). Wikipedia explains that ...

### Should a bowling game use a 2d or a 3d physics engine?

When developing games it is important to separate the game mechanics from the game representation on the screen. The game mechanics of bowling can be simplified to a pure 2d simulation by looking at ...
• 121k

### Turn a spaceship at a max rate

There's no friction in space so what is happening is actually the proper realistic behaviour: The ship spins faster and faster. If you want to limit rotation speed you can use Body.AngularDamping to ...
Accepted

### Predicted trajectory becomes less accurate in a side-on collision

The issue was that the radius that I inputted into the CircleCast was not accurate. Initially, I set the radius to that of the cueball's circlecollider2D, which would be .09f. But since I lowered the ...
• 694
Accepted

### How to avoid 2d enemy to see through walls

You only need to do two things: check if there is line of sight (raycast between the player and enemy) and if the angle of that ray is within the field of view (using atan2 to get an angle or using ...
• 86

### Getting Bodies to go "Super Fast" in Box2D

I see that there is already an accepted answer to this question. While it is in my opinion a helpful answer, it is not an answer to the original question of how to get bodies to go "super fast" and it ...

### Should I compute impact damage with energy or momentum?

You could use both, depending on case and need. Both are valid and both occur together. The difference in your case is apparently how you define loss of energy, ie. what is more convenient and ...
• 1,061
Accepted

### Creating a player that can hold different items

I'd say, don't sweat it. Your character's two hands are independent of one another, the two items groups have distinct interfaces and are meant to be used in different ways. Just use a properly-typed ...
• 1,178

### How does mass work in Box2D

As Bálint explained, mass in Box2D basically works according to Newton's laws of motion. Sounds like what you're really after though is how mass works in Box2D in practical programmatic terms. As you'...
Accepted

### How detect collision between two bodies?

Answer What you are looking for is called a Collision Callback. There is a great tutorial written by iforce2d on the topic, so I'll just give the key details here. The strategy in Box2d is to ...
• 1,705
Accepted

### What's wrong with using physics engine in 2d platformer?

It's not necessarily a completely terrible idea but there are significant cons to weigh against the pros you mention. In particular, the physics in a platformer character usually isn't totally (or ...
• 15.8k

### Having trouble implementing libGDX pause

This is actually, not LibGDX related at all. You just need to set a flag on your code boolean isPaused = false; or something alike, and change its value upon ...
• 5,156
Accepted

### Having trouble implementing libGDX pause

There's another more convenient way to pause your game: delta time manipulation. I prefer delta time manipulation because you do not have to individually place ...
• 7,870
Accepted

### Is there a "Least Terrible Method" for sharing Entities over Network?

Preface: I'm not familiar with Box2D, but these structures can be found in Boost Geometry (R-trees) if you are really interested, as well as other libraries: Premature Optimization (Don't Do it) ...
• 1,763

### How to set a box2d body to follow a strict path

If you don't need the bat to be a Box2D Body then an easy way to achieve this is just to use a Spline, ...
• 4,516

### How can i collide two bodies without filtering(collision filtering)?

setfdef.isSensor = false; and fixdef.isSensor = false; A sensor shape collects contact information but never generates a ...
• 317
Accepted

### Character overlaps with static objects

The main problem is the drawn rotation in degrees does not match the simulated body's rotation in radians. Your initial rotation of 45 is never applied to the body, so it is falling flat. Box2D uses ...
• 446

### Ledge climb animation and movement (2d platformer)

i believe you need more design choices here before you can make a proper decission, specifically, what can happen to the character while he is hanging/climbing? since you said the game is physics ...
• 310
Accepted

### Should I compute impact damage with energy or momentum?

If you want realism, you should consider that on impact kinetic energy can be transformed in a few different ways. It can cause movement, or be converted into other forms of energy, usually by ...
• 244

### Move body to mouse click and stop

Once you have the destination determined, it can be done in two popular ways: Tweening. That is the most simple way of transforming an object to a destination in exact N seconds with the ease ...
Accepted

### How to calculate move forward direction in Libgdx with Box2d body

Let's take your image as an example and make a triangle out of it (no hate on drawing skills haha). By treating this problem like a triangle we can apply some trigonometry to this problem and ...
• 7,870