Relating to the motion of objects through space (in 2 dimensions (x,y)) and time. Including concepts such as acceleration (thrust and gravity), mass, collision response, friction and more.

learn more… | top users | synonyms

63
votes
5answers
26k views

Good 2D Platformer Physics [closed]

I have a basic character controller set up for a 2D platformer with Box2D, and I'm starting to tweak it to try to make it feel good. Physics engines have a lot of knobs to tweak, and it's not clear to ...
5
votes
5answers
2k views

How to lead a moving target from a moving shooter

I saw this question: Predicting enemy position in order to have an object lead its target. My situation is a little different though. My target moves, and the shooter moves. Also, the shooter's ...
12
votes
4answers
2k views

How do I calculate rotation caused by bounce friction?

Following on from my previous question: I have the ball quite realistically bouncing from surfaces it hits. Now I'd like to make it spin from the friction of the hit. Showing this is simple enough: I ...
16
votes
6answers
9k views

How do I build a 2D physics engine? [closed]

The most advanced games I've made are a 8-ball pool game made with the physics engine Box2dFlashAS3 and a platform game with levels. When I did platform games, I've always wished to know how to make ...
32
votes
6answers
5k views

Analysis of Mario game Physics [closed]

I know there's a breakdown of Sonic the Hedgehog physics found here, and I was wondering, does there exist a breakdown of any of the Mario games? Something similar to this but for Mario is what I'm ...
9
votes
3answers
652 views

Impulsioned jumping

There's one thing that has been puzzling me, and that is how to implement a 'faux-impulsed' jump in a platformer. If you don't know what I'm talking about, then think of the jumps of Mario, Kirby, and ...
14
votes
3answers
3k views

How do I handle moving platforms in a platform game?

I don't want to use box2d or anything, I just want simple moving platforms (up-down, left-right, diagonal and circular paths). My question is to handle the update order / control hierarchy so that the ...
14
votes
2answers
5k views

2D Planet Gravity

I'm trying to make a simple game where a spaceship is launched and then its path is effected by the gravity of planets. Similar to this game: http://sciencenetlinks.com/interactives/gravity.html I ...
16
votes
2answers
4k views

Why is RK4 better than Euler integration?

At the end of these great slides, the author compares all the different integrators presented. One way or another, they all fall short except for Improved Euler Integration and Runge Kutta 4 ...
2
votes
2answers
4k views

Arc'd jumping method?

Okay, so I'm making a platformer, and I wanna know how I can make a arc'd jump easily. Like what Mario does in super Mario Bros 1. Any ideas on a simple way to accomplish this?
6
votes
2answers
2k views

How can I implement rectangle collision response?

I am working on a game in JavaScript and my current implementation of collision uses the shortest distance to push the intersecting object away, which isn't always correct. I've made this diagram of ...
4
votes
1answer
1k views

Friction in 2D game

I'm developing a 2D platformer, although this question could probably apply to just about any 2D type physics; What is the equation for friction? I have sort of a hacky type of friction set up in my ...
26
votes
6answers
4k views

Implementing a wrapping wire (like the Worms Ninja Rope) in a 2D physics engine

I've been trying out some rope-physics recently, and I've found that the "standard" solution - making a rope from a series of objects strung together with springs or joints - is unsatisfying. ...
6
votes
4answers
1k views

Determing an object's position along a curve over time

I have some objects in my game which are "thrown". At the moment I am trying to implement this by having these objects follow a parabolic curve. I know the start point, the end point, the vertex and ...
4
votes
1answer
567 views

Algorithm for randomly generating reachable platforms

I want to randomly generate reachable platforms on the fly for a 2D game. Right now, I am just creating platforms at random x,y positions. Only 4 platforms can exist at once, so once the 5th one is ...
4
votes
2answers
725 views

Tracking Object Position - Firing on a Trajectory

How can I calculate the position of an object after "firing" it from a fixed point? I am to create a small game - most likely with canvas (pure HTML, JS based) or Adobe Flash - in which the player ...
4
votes
1answer
257 views

How do I simulate a trampoline?

I'm quite new to game development. I was pretty impressed with the elastic effect I saw in this flash game when the ball hits the trampolines and I'm wondering how to recreate it. I've done some ...
1
vote
1answer
892 views

Movement and rotation of bodies in top down game

We are developing a 2D top down game with libgdx using the included box2d as physics engine. We don't want our bodies to accelerate but to instantly move with the wanted velocity. The bodies are ...
8
votes
1answer
430 views

How can I copy or back-calculate definitions for an entire b2World?

I'm working on a platformer where I'd like to be able to move or copy bodies between multiple Box2D b2Worlds. The desire has cropped up three times now - moving objects between documents in my editor, ...
3
votes
1answer
469 views

How to implement server side physics?

I am working on 2-player 2d sidescroller. How should I implement the physics on the server? Use one world for every game or use a big world in which I add every 2 player that start a game? I have ...
1
vote
1answer
721 views

Box2d contant speed before and after collision

I want to make my body fly at constant speed, how to make it fly at constant speed before and after collision? I set restitution of my body to 1.0 but after some direct and powerful collisions my ...
11
votes
4answers
4k views

Vehicle physics with skid

How would I go about creating vehicle physics for a car that can loose traction? I want it to seem like the driver has a flat foot, so when you press the gas, they cars driving (rear) wheels loose ...
20
votes
7answers
2k views

Optimizing gravity calculations

I've got a bunch of objects of varying size and velocity which gravitate towards each other. On every update, I have to go over every object and add up the forces due to gravity of every other object. ...
20
votes
3answers
1k views

How does one avoid the “staircase effect” in pixel art motion?

I am rendering sprites at exact pixel coordinates to avoid the blurring effect caused by antialiasing (the sprites are pixel-art and would look awful if filtered). However, since the movement of the ...
17
votes
1answer
3k views

Ideas for 2D Water Simulation

I am looking for any input on simulating water in 2D, against a rather large (call it) blocked/not blocked array (viewed from the side). I have come up with the following ideas: Cell Automata Do a ...
10
votes
2answers
2k views

Continuous Physics Engine's Collision Detection Techniques

I'm working on a purely continuous physics engine, and I need to choose algorithms for broad and narrow phase collision detection. "Purely continuous" means I never do intersection tests, but instead ...
8
votes
3answers
1k views

Forces on a wire in a 2D environment? (Physics)

Assume I have a physics primitive I am going to call a "wire" wrapped around a 2D environment (as described in this question). Here's an illustration of what that might look like: In the example ...
8
votes
4answers
1k views

Not sure how to handle “deceleration”

I say "deceleration" because I'm not using acceleration at the moment (it is being calculated, it's just set to 0 0); what I mean is moving the velocity back towards zero, eventually stopping. I'm ...
5
votes
4answers
6k views

2D AABB collision response

I'm making a simple platformer, and I wanted simple collision handling. So I gave all my objects an AABB hitbox and tried to resolve collisions. However, I can't get it to work. My main character has ...
4
votes
1answer
2k views

Box2D platformer movement. Are joints a good idea?

So i smashed my brains trying to make my character move. As i wanted later in the game to add explosions and bullets it wasn't a good idea to mess with the velocity and the forces/impulses didn't work ...
9
votes
2answers
2k views

How can I make a character walk on uneven walls in a 2D platformer?

I want to have a playable character who can "walk" on an organic surface at any angle, including sideways and upside-down. By "organic" levels with slanted and curved features instead of straight ...
8
votes
1answer
3k views

Basic Box2D collision detection

I don't understand how to listen for collisions in Cocos2D/Box2D. Say I have two dynamic circle bodies. One is very small and the other is relatively large. When the small circle collides w/ the ...
5
votes
4answers
588 views

Channelling an explosion along a narrow passage

I am simulating explosions in a 2D maze game. If an explosion occurs in an open area, it covers a circular region (this is the easy bit.) However if an explosion occurs in a narrow passage (i.e ...
3
votes
2answers
1k views

When and how should I apply forces in a Cocos2D + Box2D game?

I have some small circles just rolling across the bottom of the screen in my Cocos2D/Box2D iOS app. The bodies are dynamic... so I make them roll by applying a horizontal force to the center of mass ...
2
votes
3answers
2k views

How do I change my gravity and jumping logic to put the character at a specific height at a specific point in time?

I'm making a 2D platformer on Android using libGDX. One thing I've had a problem with recently is gravity and jumping. I found a few tutorials on the internet and was able to come up with this... ...
9
votes
1answer
2k views

What is the difference between an impulse and a force related to a physics engine?

What is the difference between an application of an impulse and an application of a force in relation to a physics engine?
6
votes
3answers
671 views

How do I make a moving object stop smoothly at the end of a path?

There are a dozen ways I could word this question, but to keep my thoughts in line, I'm phrasing it in line with my problem at hand. So I'm creating a floating platform that I would like to be able ...
6
votes
2answers
3k views

2D soft-body physics engines?

Hi so i've recently learned the SFML graphics library and would like to use or make a non-rigid body 2D physics system to use with it. I have three questions: The definition of rigid body in Box2d is ...
6
votes
2answers
2k views

How to calculate the exit speed of ball bouncing off a solid surface

Hey all, I am working on a simple game to include some rigid body dynamics, involving placing (moving & rotating) some springs to bounce a falling ball into a target area. My problem is correctly ...
4
votes
1answer
2k views

How can I convert a 2D bitmap (Used for terrain) to a 2D polygon mesh for collision?

So I'm making an artillery type game, sort of similar to Worms with all the usual stuff like destructible terrain etc... and while I could use per-pixel collision that doesn't give me collision ...
4
votes
1answer
2k views

How can I implement fixed joints in a 2D physics system?

I'm developing a simple, 2D physics system to complement an entity/component game object framework. So far, I have implemented some basic, tutorial-level physics. An entity that is affected by physics ...
3
votes
3answers
253 views

Physics System ignores collision in some rare cases

I've been developing a simple physics engine for my game. since the game physics is very simple I've decided to increase accuracy a little bit. Instead of formal integration methods like fourier or ...
5
votes
3answers
352 views

How do you calculate the rotational velocity of a flying object?

When a arrow shaped object is fired it slowly adjusts it's rotation to match the direction it is moving. But what is the actual physics behind it? The question is: How many degrees does the ship ...
5
votes
1answer
443 views

2D Magnet-like repelling behavior

If somebody wanted to develop a system between two intersecting rectangles so that the rectangles would, in a gradual process, push eachother away from one another until no longer intersecting, with ...
5
votes
2answers
832 views

Collision response for 2D racing game

The title is fairly self-explanatory. I have a 2D racing game that utilizes per-pixel collision detection (the track is essentially two bitmaps, one for the graphics, one for collision data). The ...
2
votes
5answers
2k 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 ...
2
votes
3answers
2k views

Game physics / 2D Collision detection AS3

I know there are some methods you can use like hittestPoint and so on, but I want to see where my movieclip colliedes with another another movieclip. Any other methods I can use? by any chance does ...
2
votes
2answers
1k views

Find meeting point of 2 objects in 2D, knowing (constant) speed and slope

I have a gun which fires a projectile that has to hit an enemy. The problem is that the gun has to be automatic, i.e. - choose the angle in which it has to shoot, so that the projectile hits the enemy ...
1
vote
2answers
448 views

Throw object towards predefined place? [duplicate]

I have a 2D side-view game with object attributes such as x, y, speedX, etc. Now I want to throw a given object from any place on the screen onto a defined goal place, in such a way that its ...
1
vote
1answer
139 views

Increase restitution (bounciness) of an object in a JavaScript formula

I'm going slightly around the houses on this one. I originally started a thread over on Stack Overflow about it but then it seemed to diverge into mathematics, with no joy from the SO community over ...